O'Reilly logo

Definitive XML Schema by Priscilla Walmsley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required