FIX: XML Element Retains Datatype After Datatype Attribute Is Programmatically Removed (262545)



The information in this article applies to:

  • Microsoft XML 2.0

This article was previously published under Q262545

SYMPTOMS

The MSXML 2.0 parser retains the datatype of an element even after the datatype attribute (dt:dt) is programmatically removed through the Document Object Model (DOM). This causes validation to occur for the named datatype even after the datatype constraint has been removed.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem has been fixed in version 2.5 of the MSXML parser. To download the latest version of the parser, visit http://msdn.microsoft.com/xml/default.asp.

MORE INFORMATION

Steps to Reproduce Behavior

To reproduce this behavior, insert the following code into a new text document and save the document as repro.htm:
<HTML>
<BODY>
	<XML id=xmlid>
		<A>
		  <B xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int">3</B>
		</A>
	</XML>
	<SCRIPT For=window Event=Onload>
		alert(xmlid.xml);
		xmlid.documentElement.childNodes(0).attributes.removeNamedItem("dt:dt");
		alert(xmlid.xml);
		xmlid.documentElement.childNodes(0).text = "foot";
	</SCRIPT>
</BODY>
</HTML>
				
Browse to the page using an Internet Explorer Web browser on a computer with version 2.0 of the MSXML parser installed. The following error is generated:
Error: Error parsing 'foot' as int datatype.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbMSXML250fix KB262545