XML

Summary

Although DTDs certainly represent a technology that is sufficient for modeling XML document data, XML Schema provides a much more advanced alternative that is rapidly replacing DTDs for defining XML schemas. XSD schemas are constructed using the XSD markup language, which includes elements and attributes for describing the structure of custom XML-based markup languages. This means that you create XSD schema documents in the same manner as you create any other XML document, which makes XSD schemas immediately more accessible to XML developers than DTDs.

This tutorial explored the inner workings of XSD schemas and taught you the fundamental skills necessary to design and create them. After explaining the different types of XSD data and how to use each of them, the tutorial showed you a complete example schema created in XSD. Admittedly, XSD is a fairly complex topic that is a bit tough to absorb all at once. Much of the complexity can be eliminated if you rely on a schema tool such as those mentioned in this lesson.

Q&A

Q.

Are there any simple types other than the ones mentioned in this tutorial?

A.

Yes. In addition to the simple types you learned about in this tutorial, there are a few other types such as binary and uriReference that I didn't mention. These types were left out of the lesson primarily for the sake of brevity, as it is difficult to cover the entirety of the XSD language in a single tutorial. Besides, the aim of this tutorial is not to make you an XSD expert but to give you the essential knowledge required to design and create XSD schemas.

Q.

I still don't quite understand the distinction between local and global components in an XSD schema. What gives?

A.

Elements and attributes are considered global if they are declared directly below the xsd:schema element. If they are declared anywhere else, they are considered local. Global elements and attributes are used differently in that they must be referenced in order to factor into a schema. Contrast this with local elements and attributes, which are automatically referenced simply by virtue of being local.