XML technologies / XML Schema / Our first schema / First lessons
(Excerpt from “XML Schema” by Eric van der Vlist)
Even this simple example schema taught us much about what W3C XML Schema offers.
W3C XML Schema is modular
We defined simple components, elements and attributes here, and used them to build complex ones. Later chapters cover other component types. This is a fundamental principle guiding the creators of W3C XML Schema, who borrowed many object-oriented design concepts.
If data types parallel classes, elements and attributes resemble objects. Each definition in our first schema resembles an object; referencing a component to construct an element resembles creating an object by cloning the existing component.
Next we will create components in place where needed, and create types from which elements and attributes are obtained like objects instantiated from classes.
W3C XML Schema addresses structures and data typing
Notice that W3C XML Schema addresses two validation levels here: document structure and leaf-node contents. The W3C distinguishes these levels through relatively independent recommendation parts, Part 1: Structures and Part 2: Datatypes.
Simple types address typing and constraints on XML leaf-node contents, while complex types specify document structure: a substantial difference.
Flat design, global components
Finally, notice the flat design: every component, element or attribute, is directly below document element xs:schema.
Components directly beneath document element xs:schema are global. They can be referenced anywhere in this schema or another including or importing it, as later chapters explain; all global elements can serve as document roots.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de