When to Use W3C XML Schema
You should probably create XML Schema for your XML documents if any of the following apply:
The order and number of nodes in your document must be constrained.
The data within your document’s nodes must be constrained more specifically than a DTD allows.
You wish to generate code to read and write XML to and from .NET types or a relational database using
XmlSerializerorXmlDataDocument.
Conversely, you should strongly consider sticking with validation by DTD only if all of the following apply:
Nodes may appear in your XML document in any order and number.
The data in your document’s nodes may be free-form, and need not be constrained.
You will be reading and writing data to and from XML documents only using
XmlReader,XmlWriter,XmlDocument,XPathDocument, and the other built-in .NET XML types.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access