Microsoft KB Archive/290910

= FIX: Default Attribute Value for Nondeclared Elements Does Not Exist in DOM =

Article ID: 290910

Article Last Modified on 8/12/2005

-

APPLIES TO


 * Microsoft XML Parser 2.0
 * Microsoft XML Parser 2.5
 * Microsoft XML Parser 2.6
 * Microsoft XML Core Services 4.0

-



This article was previously published under Q290910



SYMPTOMS
When you load an XML document into an XML DOMDocument object after you set the validateOnParse property to False, the default attributes are not inserted for elements that are not declared explicitly in the document's document type definition (DTD).



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

This bug was corrected in Microsoft XML 3.0 Service Pack 1.

For additional information on other fixes included in Microsoft XML 3.0 Service Pack 1, click the article number below to view the article in the Microsoft Knowledge Base:

292935 INFO: List of Issues Fixed in Microsoft XML 3.0 Service Pack 1

For the latest information and downloads of MSXML, refer to the following MSDN Web site at:

http://msdn.microsoft.com/xml/default.asp



MORE INFORMATION
Section 3.3 of the World Wide Web Consortium (W3C) specification, located at the following Web site

http://www.w3.org/TR/2000/WD-xml-c14n-20001011#Example-SETags

indicates that the default attribute of an element should be added even if the binding element is not declared in the DTD.

Steps to Reproduce Behavior
 Create the HTML document.  Using Windows Notepad or another text editor, create a new text document.  Paste the following code into the new text document: var xmlDoc = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;); xmlDoc.async = false; xmlDoc.validateOnParse = false;

xmlDoc.loadXML(&quot;<!DOCTYPE doc [<!ATTLIST doc att CDATA 'default'>]> &quot;); alert(&quot;Number of attributes = &quot; + xmlDoc.documentElement.attributes.length);  Save the new text document as C:\InetPub\Wwwroot\Testpage.html.  Browse to the HTML document using Internet Explorer.</li></ol>

The number of attributes is 0 but should be 1, because the default attribute should be added automatically.

Keywords: kbbug kbfix kbmsxml300sp1fix kbmsxmlnosweep KB290910

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.