DTD to XSD conversion using Trang
The tool dtd2xsd.exe is commonly used to convert XML DTDs to XML Schemas. Unfortunately, it doesn’t convert correctly when it comes across an attribute definition for whitespace treatment:
<!ATTLIST ZZZ xml:space (default|preserve) 'preserve'>
The XML 1.1 specs make it clear that this is a valid declaration (see section 2.1 White Space Handling), but the output for this line after conversion with the dtd2xsd tool is:
<xsd:attribute name='xml:space' default='preserve'></xsd>
This is a problem, as the value “xml:space” is not valid for the name attribute of this element (schema validation available from w3.org). Fortunately there is another converter that does a better job. Trang correctly converts this line to:
<xs:attribute ref="xml:space" default="preserve"/>
Comments(0)