Chapter 2 A quick tour of XML Schema

This chapter provides a quick tour of the main components of XML Schema. It also introduces a simple example of a schema and a conforming instance that will be used and built upon throughout the book.

2.1 An example schema

Suppose you have the instance shown in Example 2–1. It consists of a product element that has two children (number and size) and an attribute (effDate).

Example 2–1. Product instance

<product effDate="2001-04-02">  <number>557</number>  <size>10</size></product>

Example 2–2 shows a schema that might be used to validate our instance. Its three element declarations and the attribute declaration assign names and corresponding data types to the components they declare.

Get Definitive XML Schema now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.