Declaring Types and Elements

The most basic thing to understand about XML schemas is the concept of using simple and complex types, and how they relate to declaring elements. Unlike with DTDs, you specify the type of the elements that you declare with schemas.

This means that the first step in declaring elements is to make sure that you have the types you want—and that often means defining new complex types. Complex types can enclose elements and have attributes, and simple types cannot do either. You can find the simple types built into XML schemas in Table 5.2. (When you specify these types in schemas, bear in mind that you'll preface them with the W3C schema prefix, usually xsd:.)

Table 5.2. Simple Types Built into XML Schema
TypeDescription ...

Get Inside XML now with O’Reilly online learning.

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