Why Use XML Document Types Instead of IS Document Types?
While XML document types and IS document types have similar uses and, in some cases, similar sources as both can be created from an XML schema definition, XML document types offer the following distinct benefits:
Improved XML namespace handling. XML document types do not use prefixes from the XML schema definition in the names of document types or fields (variables). Instead IS uses the following format for XML document type names, XML field names, and names of fields within XML document types: NCName#NamespaceURI. This naming convention ensures that XML document types, XML fields, and fields within a document type have a unique name, preventing the conflicts that arise when IS document types are generated using one set of prefixes and the instance XML documents use a different set of prefixes.
Nested and repeating model group support. IS can create XML document types from XML schema definitions that contain nested model groups or repeating model groups. An IS document type cannot correctly represent nested and repeating model groups.
Any attribute support. IS can create XML document types from XML schema definitions that contain the
anyAttribute element. An IS document type cannot correctly represent the
anyAttribute element.
Improved support for substitution groups.
Improved support for
any element.
Support for xsi:nil and xsi:type on simple types (String fields). IS document types support xsi:nil and xsi:type on complex types (Document fields) only.
Improved handling of identically named fields at the same level.
If you want your solutions to incorporate or leverage any above the above items, consider using XML document types instead of IS document types in your solutions.
Note: | XML document types and instance documents based on XML document types are intended to implement XML Schema and XML as closely as possible. Behavior that is inconsistent with XML Schema and XML will be treated as known issues that need resolution. Implementations should not exploit behavior that is inconsistent with XML and XML schema as it may have unpredictable results. |