Altova XMLSpy 2025 Professional Edition

Convert Schema to DTD

Home Prev Top Next

The Convert Schema to DTD command is enabled when an XML Schema is the active document. It converts an XML Schema document (XSD) into a DTD.

 

The command pops up a Save dialog, in which you select a location at which to save the generated DTD file. Click Save to carry out the conversion. The DTD file is generated and opened in XMLSpy.

 

Note the following points:

 

1.When you convert an XML Schema to a DTD, the namespace prefixes used in the XML Schema—not the namespace URIs or the namespace declarations—are carried through to the names of the corresponding elements and attributes in the DTD.

2.Since XML parsers ignore namespaces when validating an XML document against a DTD, the namespace declarations themselves are not converted.

3.The elementFormDefault and attributeFormDefault attributes of the xs:schema element determine what elements and attributes have their prefixes included in the conversion process. If set to unqualified, then only globally declared elements and attributes, respectively, include prefixes in the conversion. If set to qualified, all element and attribute names have their prefixes included in the conversion.

4.Prefixes are converted to their corresponding string value plus a colon. Elements and attributes in default namespaces are converted  to elements and attributes with names that begin with the string: default_NS_X, where X is an integer (starting with 1 and having a maximum value equal to the number of default namespaces used in the XML Schema).

5.In the DTD, element names are composed of parameter entities. This enables you to easily change the prefix in the DTD should the prefix in the XML document ever need to change. Parameter entity definitions can be changed either in the DTD document itself or by overriding the parameter entity definitions in the XML document's internal DTD subset.

 

Note:Namespaces have no semantic value in DTDs, and namespace prefixes carried over from the XML Schema become merely a lexical part of the name of the element or attribute defined in the DTD.

 

© 2018-2024 Altova GmbH