Back in Defining Data with DTD Schemas, "Defining Data with DTD Schemas," you learned how to describe a custom markup language using a DTD. Although DTDs can certainly get the job done, a more modern alternative is available for describing XML-based markup languages. This alternative is called XML Schema, and schemas developed using XML Schema are known as XSDs.
Getting back to the Scott Adams quote, some XML developers have argued that maybe there is a shred of Dilbert ridiculousness to XML Schema given the complexity of the resulting code involved in creating an XSD. The W3C (World Wide Web Consortium) initially set out to improve upon DTDs by developing a schema technology that was based on XML.
The end result is known as the XML Schema Definition Language, or XSD, which is now an official W3C standard. XSD schemas are used similarly to DTDs in that they provide a means of defining a custom markup language and validating XML documents. However, XSDs are considerably more powerful than DTDs and give you much finer control over the design of markup languages. As with many technologies, power and flexibility adds complexity, so you'll find that XSD schemas are generally a bit larger and more complex than DTDs.
In this tutorial, you'll learn
- The basics of XML Schema
- How to use elements and attributes in XSD schemas
- How to work with simple and complex data types
- How to build a complete XSD schema and use it to validate a document