O'Reilly logo

Professional XML by Michael Kay, Kent Sharkey, Sam Ferguson, Alessandro Vernet, Bill Evjen, Thiru Thangarathinam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. XML Schemas

In the previous chapter, you saw that defining a vocabulary for the XML that you create or work with is an important step in any validation process. If you accept XML documents, you need the means to programmatically validate the structure of those XML documents. Validating an XML document means initiating a process to ensure that the XML document follows a set of rules regarding structure. It is quite difficult to process an XML document that is doesn't have the structure you expect.

In the previous chapter, you reviewed using DTDs — or document type definitions in XML validation. DTDs are the original way to describe the vocabulary of an XML document. If you look at the XML specification (found at w3.org/TR/REC-xml/) you find that DTDs are included in this definition. You don't find the XML Schemas specifications defined in the XML specification. XML Schemas were defined after the creation of the XML specification.

The W3C made the XML Schema a recommendation in October of 2004. You can find the various specifications in the following places on the Internet:

  • XML Schema Part 0: Primerw3.org/TR/xmlschema-0/

  • XML Schema Part 1: Structuresw3.org/TR/xmlschema-1/

  • XML Schema Part 2: Datatypesw3.org/TR/xmlschema-2/

XML Schemas are the default way to represent a vocabulary, and they are the best option for new development. This chapter looks at the basics of XML Schemas—including how to build and consume them.

The Issues with DTDs

The previous chapter reviews DTDs and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required