Sams Teach Yourself XML in 21 Days

Sams Teach Yourself XML in 21 Days

By Steven Holzner

Day 6. Creating Valid XML Documents: XML Schemas

Yesterday and on Day 4, "Creating Valid XML Documents: DTDs," you took a look at working with DTDs to validate XML documents. Today and tomorrow you'll get a look at the other way of validating XML documents: using XML schemas. XML schemas allow you considerably more precision than DTDs do, as you're about to see. Here's an overview of today's topics:

As of this writing, this quote is available on the W3C XML Activity Page (http://www.w3.org/XML/Activity.html):

For the past two days, you've been working with DTDs, but DTDs are actually pretty basic. As XML developed, XML authors asked the W3C for a more comprehensive and detailed way of specifying the syntax of XML documents, and the W3C responded with XML schemas. The W3C XML schema working group was originally created to tackle a number of issues that DTDs didn't handle well—handling namespaces when validating documents, allowing data typing, allowing and restricting inheritance for validation methods, creating our own data types, and other issues. As you're going to see, XML schemas let you spell out the syntax of XML documents far more precisely than DTDs ever could. Originally, there was very little software that could handle XML schemas, but today you'll find more and more XML schema-aware software available.

XML schemas are a W3C recommendation, and that recommendation is available in these three documents:

Right now, the XML schema recommendation is in version 1.0, but the W3C is starting to think about version 1.1. Nothing's been firmed up at this point, however. Here's what W3C says about version 1.1:

Share ThisShare This

Informit Network