INFO: List of Issues Fixed in Microsoft XML 4.0 Service Pack 1 (Part 2 of 4) (318887)



The information in this article applies to:

  • Microsoft XML 4.0
  • Microsoft XML 4.0 SP1

This article was previously published under Q318887

MORE INFORMATION

xsd:decimal and mininclusive = 0.00

In the October 2001 RTM version of MSXML 4.0, when you specify a 0 with decimal places (such as 0.0 or 0.00) as the value for a minInclusive facet, and the facet is defined for an XSD element of the decimal XSD primitive data type, you receive the following schema validation error message, even though this action is valid:
It is an error for the value specified for minInclusive to be greater than the value specified for maxInclusive for the same datatype.
To reproduce this behavior with MSXML 4.0, use the following code to create a sample XSD document named Decmininclusive.xsd, and then add Decmininclusive.xsd to an MSXML 4.0 XMLSchemaCache object:
<xsd:schema targetNamespace="urn:MinTest" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instances"
	    elementFormDefault="qualified"
            version="1.00">

<xsd:simpleType name="ValueType">
 <xsd:restriction base="xsd:decimal">
  <xsd:minInclusive value="0.0"/>
  <xsd:maxInclusive value="1"/>
 </xsd:restriction>
</xsd:simpleType>

</xsd:schema>
				
back to the top

The Final Attribute of the XSD simpleType Element Should Support "extension" to Stop Use in Complex Types

The final attribute of the XSD simpleType element should support a value of "extension" to prevent a simpleType definition from being derived by extension to yield a complexType element. However, the October 2001 RTM release of MSXML 4.0 does not implement support for the "extension" value in its implementation of the final attribute of an XSD simpleType element. If you try to set the value of the final attribute of an XSD simpleType element to "extension", you receive the following schema validation error message:
The value of the 'final' attribute may not be 'extension'
To reproduce this behavior with the October 2001 RTM release of MSXML 4.0, use the following code to create a sample XSD document named Simpletypeextensionrepro.xsd, and then add Simpletypeextensionrepro.xsd to an MSXML 4.0 XMLSchemaCache object:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:simpleType name="myType" final="extension">
		<xs:restriction base="xs:string" />
	</xs:simpleType>

	<xs:complexType name="ct">
		<xs:simpleContent>
			<xs:extension base="myType">
				<xs:anyAttribute />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:element name="myElement" type="ct" />
	
</xs:schema>
				
back to the top

Default Data Type for an XSD Element with a Fixed Value

The XSD string primitive data type should be used as the default data type when no data type is specified for an element with a fixed value. However, when you add the following sample XSD schema, Defaulttyperepro.xsd, to an XMLSchemaCache object in the October 2001 RTM release of MSXML 4.0
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
	<xsd:element name="doc" fixed="abc" />
</xsd:schema>
				
you receive the following error message:
'default' or 'fixed' value error
back to the top

Validation of Attributes with Fixed Values

You should receive a validation error message when an attribute in an XML instance document is assigned a value that is different from the fixed value that is defined for the attribute in the XSD schema. However, when you use the October 2001 RTM release of MSXML 4.0 to validate the following XML data, Fixedvalueattribute.xml
<doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:noNamespaceSchemaLocation="addB109.xsd" 
     att="abc"
/>
				
by using the following XSD schema, Fixedvalueattribute.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
	<xsd:attribute name="att" fixed="123" />	
	<xsd:element name="doc">
		<xsd:complexType>
			<xsd:attribute ref="att" />
		</xsd:complexType>		
	</xsd:element>
</xsd:schema>
				
the parser does not generate a validation error message to report that the value that is assigned to the att attribute in the XML instance document and the fixed value that is defined for the attribute in the XSD schema do not match.

back to the top

xsd:any and processContents="skip"

An XML processor should not try to validate any elements from the specified namespaces when a value of "skip" is assigned to the processContents attribute of the XSD any element, but the October 2001 RTM release of MSXML 4.0 does not follow this specification. Because of this, you may receive validation error messages when you assign a value of "skip" to the processContents attribute of the XSD any element.

Steps to Reproduce the Behavior
  1. Create and save the following sample XSD and XML instance documents in the root folder of your hard disk: A.xsd
    <schema xmlns="http://www.w3.org/2001/XMLSchema" 
    	targetNamespace="a"
            xmlns:a="a"
            elementFormDefault="qualified">
    
    	<element name="SkipContainer" type="a:SkipContainerType"/>
    
    	<complexType name="SkipContainerType">
                <sequence>
                      <any namespace="##other" processContents="skip"/> 
                </sequence>
    	</complexType>
    </schema>
    					
    B.xsd
    <schema xmlns='http://www.w3.org/2001/XMLSchema' version='1.0'
            targetNamespace='b'
            xmlns:b='b'
            elementFormDefault='qualified'>
    
    	<element name="test" type="b:testType"/>
    
    	<complexType name="testType">
    	    <attribute name="b1" type="string" use="required"/> 
    	</complexType>
    </schema>
    					
    Test.xml
    <?xml version='1.0'?>
    <a:SkipContainer xmlns:a="a" xmlns:b="b">
    		<b:test/>
    </a:SkipContainer>
    					
  2. Use the following Microsoft Visual Basic 6.0 code to validate the Test.xml file:NOTE: You must add a reference to Microsoft XML, v4.0 to your Visual Basic project.
    Dim sc As msxml2.XMLSchemaCache40
    Set sc = New msxml2.XMLSchemaCache40
    sc.Add "a", "c:\a.xsd"
    sc.Add "b", "c:\b.xsd"
    
    Dim doc As msxml2.DOMDocument40
    Set doc = New msxml2.DOMDocument40
    doc.async = False
    Set doc.schemas = sc
    doc.Load "c:\test.xml"
    If doc.parseError.errorCode <> 0 Then
      Debug.Print doc.parseError.reason
    Else
      Debug.Print doc.xml
    End If
    					
    The Visual Basic code generates the following validation error message, which indicates that the parser validated the <b:test> element in Test.xml:
    Required attribute 'b1' is missing
    The parser should not validate this element, because the processContents attribute of the XSD any element in A.xsd has been assigned the value "skip".
back to the top

No Validation Error Is Raised When XSD Uniqueness Is Violated

The value of an XSD unique element or attribute cannot be duplicated in an XML instance document. However, when you use the October 2001 RTM release of MSXML 4.0 to validate the following XML document, Uniquerepro.xml
<?xml version="1.0"?>
<Catalog>
    <products>
	<product productID="a1"/>
	<product productID="a1"/>
    </products>
</Catalog>
				
by using the following XSD schema, Uniquerepro.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

   <xsd:element name="Catalog" type="catalogType"/>

   <xsd:complexType name="catalogType">
	<xsd:choice>
   	<xsd:element name="products">
		<xsd:complexType>
			<xsd:choice maxOccurs="100">
			<xsd:element name="product" maxOccurs="unbounded">
	 			<xsd:complexType>
		  			<xsd:attribute name="productID" type="xsd:string" use="required"/>
		 		</xsd:complexType>
			</xsd:element>


			</xsd:choice>
		</xsd:complexType>

		<xsd:unique name="unique_part"> 
			<xsd:selector xpath="./product" />
			<xsd:field xpath="@productID"/>
		</xsd:unique>

	</xsd:element>	
	</xsd:choice>
   </xsd:complexType>

</xsd:schema>
				
the parser does not generate a validation error to reflect the duplication of values for the productID attribute that has been defined as unique in the XSD schema.

back to the top

xsd:element Blocks Further XSD redefine Elements

An XSD schema can contain multiple redefine elements, and all XSD redefine elements in a schema should occur before any global top-level XSD elements. However, the October 2001 RTM release of the MSXML 4.0 XSD compiler generates the following schema validation error message when an XSD schema contains two or more XSD redefine elements, even if all of the redefine elements occur before any top-level XSD element declarations:
A 'redefine' element cannot appear at this location
This problem occurs only when one or more xsd:redefine elements follow an xsd:redefine element with a child xsd:element that redefines an element that is declared in another schema. The schema compiler does not verify whether the parent of the xsd:element (which is nested in the redefine element) is the schema element.

To reproduce this behavior in the October 2001 RTM release of MSXML 4.0, create the following schemas in the same physical folder, and then add Redefines.xsd to an MSXML 4.0 XMLSchemaCache object:

Personname.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="personName">
  <xs:sequence>
   <xs:element name="title" minOccurs="0"/>
   <xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

</xs:schema>
				
Address.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="Address">
  <xs:sequence>
   <xs:element name="State" type="xs:string" minOccurs="0"/>
   <xs:element name="City"  type="xs:string" minOccurs="0"/>
  </xs:sequence>
</xs:complexType>

</xs:schema>
				
Redefines.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:redefine schemaLocation="personName.xsd">
  <xs:complexType name="personName">
   <xs:complexContent>
    <xs:extension base="personName">
     <xs:sequence>
      <xs:element name="generation" type="xs:string"  minOccurs="0"/>
     </xs:sequence>
    </xs:extension>
   </xs:complexContent>
  </xs:complexType>
</xs:redefine>

<xs:redefine schemaLocation="address.xsd">
  <xs:complexType name="Address">
   <xs:complexContent>
    <xs:extension base="Address">
     <xs:sequence>
      <xs:element name="Zip" type="xs:string" minOccurs="0"/>
     </xs:sequence>
    </xs:extension>
   </xs:complexContent>
  </xs:complexType>
</xs:redefine> 

<xs:element name="author" type="personName"/>

</xs:schema>
				
back to the top

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

318886 INFO: List of Issues Fixed in Microsoft XML 4.0 Service Pack 1 (Part 1 of 4)

318889 INFO: List of Issues Fixed in Microsoft XML 4.0 Service Pack 1 (Part 3 of 4)

318890 INFO: List of Issues Fixed in Microsoft XML 4.0 Service Pack 1 (Part 4 of 4)


Modification Type:MajorLast Reviewed:4/16/2002
Keywords:kbinfo kbMSXML400fix KB318887