FIX: Duplicate Attributes in XML when DTD Has Attributes with Default Values (292038)



The information in this article applies to:

  • Microsoft XML 3.0

This article was previously published under Q292038

SYMPTOMS

When a document type definition (DTD) has attributes with default values, the resulting XML file contains duplicate attributes.

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:

MORE INFORMATION

Steps to Reproduce Behavior

  1. Paste the following code in a new text document, and save the file as Repro.dtd:
    <!ELEMENT root (tag)>
    <!ELEMENT tag EMPTY>
    <!ATTLIST tag
    attr1 (value11|value12) "value11"
    attr2 (value21|value22) "value22"
    >
    					
  2. Paste the following text in another new document, and save the file as Repro.xml in the same location as the DTD file you just created:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE root SYSTEM "repro.dtd" >
    <root>
      <tag attr2="value21"/>
    </root>
    					
  3. Using Microsoft Internet Explorer, browse to Repro.xml.
The following is the expected result:
<?xml version="1.0" encoding="ISO-8859-1" ?> 
  <!DOCTYPE root (View Source for full doctype...)> 
- <root>
  <tag attr2="value21" attr1="value11" /> 
  </root>
				
However, the actual result is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?> 
  <!DOCTYPE root (View Source for full doctype...)> 
- <root>
  <tag attr2="value21" attr1="value11" attr2="value22" /> 
  </root>
				

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbDSupport KbMSXML300SP1fix kbMSXMLnosweep KB292038