As you've seen in the first few chapters, the rules for XML are straightforward. It doesn't take much to create well-formed XML documents to describe any information that you want. When you create XML documents, you can categorize them into groups of similar document types based on the elements and attributes they contain. You learned that the elements and attributes that make up a document type are known as the document's vocabulary. In Chapter 3, you learned how to use multiple vocabularies within a single document using namespaces. By this time, you may be wondering how to define your own types of documents and check whether certain documents follow the rules of your vocabulary.
Suppose you are developing an application that uses the
<name> sample from Chapter 1. In the
<name> sample, you created a simple XML document that allowed you to enter the first, middle, and last name of a person. In the sample, you used the name John Fitzgerald Johansen Doe. Now suppose that users of your application input information that does not match the vocabulary you developed. How could you verify that the content within the XML document is valid? You could write some code within your web application to check whether each of the elements is correct and in the correct order, but what if you want to modify the type of documents you can accept? You would have to update your application code, possibly in many places. This isn't much of an improvement from the text ...