The Basics of Validation

There is another concept in XML that is just as important, if not more so, than well-formedness: validation. The idea behind validation is to create a document with defined structure and rules for how the content is to be organized. Then, by checking the document against the set of rules, the document can be declared valid or an error can be generated, indicating where the document is incorrectly formatted or structured.

The document that establishes the set of rules is called a schema, with a lowercase s. The terminology here can become somewhat confusing, because a schema in the generic sense is just a set of rules that define the structure. However, with XML, there are two common types of schemas that are used to support ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.