Microsoft KB Archive/818083

= INFO: List of Issues Fixed in MSXML 4.0 SP2 (Part 2 of 4) =

Article ID: 818083

Article Last Modified on 8/12/2005

-

APPLIES TO


 * Microsoft XML Core Services 4.0 Service Pack 1

-



SUMMARY
This article is part 2 of 4 in the series of articles that documents the bugs that are fixed in Microsoft XML (MSXML) 4.0 Service Pack 2 (SP2).

The following bugs have been fixed in MSXML 4.0 SP2:
 * Xsl:sort Does Not Sort the Data Correctly When You Cross-Reference Two Documents in the Sort
 * XSD Schemas: You Cannot Use an XSD Union in the Definition of Another SimpleType
 * Restriction of Abstract Classes with Abstract Particles Through Substitution Group Does Not Work
 * Access Violation Occurs When You Use an XSLT Variable to Supply the Value for the Format Parameter of Format-number
 * Program Stops Repsonding When You Call the Validate Method on an XML Document with Invalid Attribute Default ID Declaration
 * Attribute Order Changes When You Use the SetAttribute Method to Change an Existing Attribute Value
 * XSD Uniqueness Identity Constraint is Not Checked When You Use Xsi:type to Change the Type of an Element
 * MSXML 4.0 Leaks Memory When You Clone XML Nodes from Visual Basic ActiveX DLL
 * REFERENCES



Fix: Xsl:sort Does Not Sort the Data Correctly When You Cross-Reference Two Documents in the Sort
In MSXML 4.0 RTM and SP1, xsl:sort does not sort the data correctly when you cross-reference between two documents in the sort.

To reproduce the problem, use the following .xml and .xsl files:

Test.xml      Parts.xml          Test.xsl <?xml version=&quot;1.0&quot;?> <xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;> <xsl:output method=&quot;html&quot; /> <xsl:variable name=&quot;MyGroup&quot;>groupC</xsl:variable> <xsl:variable name=&quot;MyParts&quot; select=&quot;document('parts.xml')/parts&quot;/>

<xsl:template match=&quot;/large-collection&quot;> <xsl:apply-templates select=&quot;collection[@name = $MyGroup]&quot; /> </xsl:template>

<xsl:template match=&quot;/large-collection/collection&quot;> <xsl:for-each select=&quot;ref&quot;> <xsl:sort select=&quot;$MyParts/part[@id = (current)/@refid]/@type&quot; order=&quot;ascending&quot;/> <xsl:sort select=&quot;$MyParts/part[@id = (current)/@refid]/@id&quot; order=&quot;ascending&quot;/>

type: <xsl:value-of select=&quot;concat($MyParts/part[@id = (current)/@refid]/@type, ' name: ', $MyParts/part[@id = (current)/@refid]/@name, ' id: ', $MyParts/part[@id = (current)/@refid]/@id)&quot;/> </xsl:for-each> </xsl:template>

</xsl:stylesheet> back to top

Fix: XSD Schemas: You Cannot Use an XSD Union in the Definition of Another SimpleType
In MSXML 4.0 RTM and SP1, you cannot use an XSD union in the definition of another SimpleType. When you try to compile an XSD schema where an XSD union is used in the definition of another SimpleType, you receive the following error message:

Error number : -2147467259

Error Message : file:///C:/union.xsd#/schema[1]/simpleType[position = 2 and @name = 'myunion2']/union[1] Union datatype must be derived from an atomic or list datatype.

This is a valid operation according to the following statement in section 4.1.2.3 of the XSD Datatypes Specifications:

XSD Datatypes specifications

{member type definitions} The sequence of Simple Type Definition components resolved to by the items in the actual value of the memberTypes [attribute], if any, in order, followed by the Simple Type Definition components resolved to by the <simpleType> [children], if any, in order. If {variety} is union for any Simple Type Definition components resolved to above, then the that Simple Type Definition is replaced by its {member type definitions}.

To reproduce the problem, use the following XML schema: <schema targetNamespace=&quot;urn:test&quot; xmlns=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:test=&quot;urn:test&quot; elementFormDefault=&quot;qualified&quot; attributeFormDefault=&quot;unqualified&quot;> <element name=&quot;info2&quot; type=&quot;test:myunion2&quot; /> <simpleType name=&quot;myunion&quot;> <simpleType> <restriction base=&quot;decimal&quot; /> </simpleType> </simpleType> <simpleType name=&quot;myunion2&quot;> <simpleType> <restriction base=&quot;NMTOKEN&quot;> <enumeration value=&quot;a&quot; /> <enumeration value=&quot;b&quot; /> </simpleType> <simpleType> <restriction base=&quot;test:myunion&quot; /> </simpleType> </simpleType> back to top

Fix: Restriction of Abstract Classes with Abstract Particles Through Substitution Group Does Not Work
In MSXML 4.0 RTM and SP1, if an abstract complex type is defined with a particle that references an abstract globally declared element, and then restricts it by creating a complex type with a particle that is in the same substitution group as the abstract element in the base type, you receive the following error message:

Error Number: -2147467259

Error Message: file:///C:/schema.xsd#/schema[1]/complexType[position = 2 and @name = 'ContainMember2Type'] Invalid particle derivation by restriction. Base type : '{urn:my-namespace}ContainHead2Type' Derived type : '{urn:my-namespace}ContainMember2Type'

To reproduce the problem, use the following XSD schema: <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <schema targetNamespace=&quot;urn:my-namespace&quot; xmlns:my=&quot;urn:my-namespace&quot; xmlns=&quot;http://www.w3.org/2001/XMLSchema&quot;>

<element name=&quot;Head2&quot; type=&quot;string&quot; abstract=&quot;true&quot;/>

<element name=&quot;Member2&quot; type=&quot;string&quot; substitutionGroup=&quot;my:Head2&quot;/>

<complexType name=&quot;ContainHead2Type&quot; abstract=&quot;true&quot;> <element ref=&quot;my:Head2&quot;/> </complexType>

<complexType name=&quot;ContainMember2Type&quot;> <complexContent> <restriction base=&quot;my:ContainHead2Type&quot;> <element ref=&quot;my:Member2&quot;/> </complexContent> </complexType>

back to top

Fix: Access Violation Occurs When You Use an XSLT Variable to Supply the Value for the Format Parameter of Format-number
In MSXML 4.0 RTM and SP1, when you call an XSLT format-number function that has a variable as the third parameter instead of a hard-coded value, an access violation occurs. This behavior occurs only when you call the format-number function more than one time.

Example:

<xsl:value-of select=&quot;format-number($number, '#,###.00', $numberfmt)&quot;/> <xsl:value-of select=&quot;format-number($number, '#,###.00', $numberfmt)&quot;/>

To reproduce the problem, use the following XSL: <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;> <xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; indent=&quot;yes&quot;/>

<xsl:decimal-format name=&quot;locale&quot; decimal-separator=&quot;.&quot; grouping-separator=&quot;,&quot; NaN=&quot;0.00&quot; />

<xsl:variable name=&quot;numberfmt&quot; select=&quot;'locale'&quot;/> <xsl:variable name=&quot;number&quot; select=&quot;324123.12&quot;/>

<xsl:template match=&quot;/&quot;> <xsl:value-of select=&quot;format-number($number, '#,###.00', $numberfmt)&quot;/>

<xsl:value-of select=&quot;format-number($number, '#,###.00', $numberfmt)&quot;/> </xsl:template>

</xsl:stylesheet> back to top

Fix: Program Stops Responding When You Call the Validate Method on an XML Document with Invalid Attribute Default ID Declaration
In MSXML 4.0 RTM and SP1, when you call the Validate method on an XML document that has an invalid attribute default ID declaration, and the document is loaded with the validateOnParse property set to false, the program stops responding when you call the Validate method.

To reproduce the problem, use the following XML and vbscript code:

Test.xml <!DOCTYPE root [ <!ATTLIST root id2 ID &quot;x23&quot; > ]>

Test.vbs On Error Resume next

set xmlDoc = createObject(&quot;MSXML2.DOMDocument.4.0&quot;) xmlDoc.async = false xmlDoc.validateOnParse = false

xmlDoc.load(&quot;t.xml&quot;) set pErr = xmlDoc.parseError WScript.Echo &quot;LOAD ERROR : &quot; & pErr.reason

set pErr = xmlDoc.validate WScript.Echo &quot;Validate Error: &quot; & pErr.reason back to top

Fix: Attribute Order Changes When You Use the SetAttribute Method to Change an Existing Attribute Value
In MSXML 4.0 RTM and SP1, using the setAttribute(name, value) method of the DOMDocument object, changes the position of an attribute node.

To reproduce the problem, use the following VBScript: set doc = CreateObject(&quot;MSXML2.DOMDocument.4.0&quot;) doc.loadXML( &quot;<sample a='1' b='2'/>&quot;) WScript.Echo &quot;Original XML: &quot; & doc.xml doc.documentElement.setAttribute &quot;a&quot;, &quot;3&quot; WScript.Echo &quot;MSXML 4.0: &quot; & doc.xml back to top

Fix: XSD Uniqueness Identity Constraint is Not Checked When You Use Xsi:type to Change the Type of an Element
In MSXML 4.0 RTM and SP1, if the type of an element is changed to use xsi:type, the unique identity constraint is ignored.

To reproduce the problem, use the following .xsd and .xml files:

Test.xsd <xs:schema targetNamespace=&quot;http://tempuri.org/XMLSchema.xsd&quot; elementFormDefault=&quot;qualified&quot; xmlns=&quot;http://tempuri.org/XMLSchema.xsd&quot; xmlns:mstns=&quot;http://tempuri.org/XMLSchema.xsd&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;>

<xs:complexType name=&quot;property&quot; abstract=&quot;true&quot;> <xs:attribute name=&quot;name&quot; type=&quot;xs:string&quot; use=&quot;required&quot; /> </xs:complexType>

<xs:complexType name=&quot;select&quot;> <xs:complexContent> <xs:extension base=&quot;property&quot;> <xs:sequence> <xs:element ref=&quot;option&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;unbounded&quot; /> </xs:sequence> <xs:attribute name=&quot;type&quot; fixed=&quot;select&quot; /> </xs:extension> </xs:complexContent> </xs:complexType>

<xs:element name=&quot;option&quot;> <xs:complexType> <xs:attribute name=&quot;default&quot; form=&quot;unqualified&quot; fixed=&quot;true&quot; /> </xs:complexType> </xs:element>

<xs:element name=&quot;xTask&quot;> <xs:complexType> <xs:sequence> <xs:element name=&quot;xTaskProperty&quot; type=&quot;property&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;unbounded&quot;> <xs:unique name=&quot;selectdefault1&quot;> <xs:selector xpath=&quot;.//mstns:option&quot; /> <xs:field xpath=&quot;@default&quot; /> </xs:unique> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Test.xml <xTask xmlns=&quot;http://tempuri.org/XMLSchema.xsd&quot; xmlns:f=&quot;http://tempuri.org/XMLSchema.xsd&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:mstns=&quot;http://tempuri.org/XMLSchema.xsd&quot; >

<xTaskProperty name=&quot;sample&quot; xsi:type=&quot;select&quot;> <f:option default=&quot;true&quot;></f:option> <f:option default=&quot;true&quot;></f:option> </xTaskProperty> </xTask> Visual Basic code Dim doc As New MSXML2.DOMDocument40 doc.async = False doc.validateOnParse = False

doc.Load App.Path & &quot;\t2.xml&quot; doc.Validate back to top

Fix: MSXML 4.0 Leaks Memory When You Clone XML Nodes from Visual Basic ActiveX DLL
In MSXML 4.0 RTM and SP1, cloning XML nodes in Visual Basic ActiveX DLL causes memory leaks. This behavior occurs when the DOMDocument is global.

back to top

<div class="references_section">