Chapter 13. Creating Extensible Schemas
The X from XML stands for “extensible.” The goal of any schema language is to control and limit this extensibility to help the applications deal with it. Extensibility and schemas pursue two opposite goals. Carelessly written schemas may significantly reduce extensibility, and we need to keep this in mind when we design our own schemas.
Here again, we find the duality between the schema and the instance documents, and we need to distinguish between two different forms of extensibility. The extensibility of the schema, is the ability to reuse its components to create other schemas, while the extensibility of the vocabulary, is the ability to add or modify the content models with a minimal impact on the applications, and is, in fact, the openness of the schema.
Extensible Schemas
The extensibility of a schema is essentially determined by its style,
the choice of which components (elements and attributes, element and
attribute groups, and simple and complex types) have been made
global, the use of the final
and
fixed
attributes, and the optional division of
these components over different schema documents. We need to have a
look at these three factors.
Global Components
A simple example is often better than a long explanation, so to illustrate the differences between the different schema styles, we will take some examples out of our library and study complex and simple type elements and attributes.
Elements
Let’s consider the definition of the ...
Get XML Schema 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.