Chapter 4
Defining XML: XML Schema
Examples
- Example 4-1
- Example 4-2
- Example 4-3
- Example 4-5
- Example 4-6
- Example 4-7
- Example 4-9
- Example 4-10
- Example 4-11
- Example 4-12
- Example 4-13
- Example 4-14
- Example 4-15
- Download all Chapter 4 code (chapter4.zip)
Introduction to Namespaces
Namespaces are a way to associate a group of elements with each other. They're confusing at first, but don't worry. When you stare at them long enough, they actually start to make sense. XML Schemas always use namespaces.
Introduction to XML Schema
XML Schema offers another way to define the structure of XML documents. It's a more complicated, verbose and exacting way to define XML, but it's gaining popularity because of the greater control over XML it gives you.
Simple Types
Simple-type elements are essentially those elements that are just strings, numbers, times, Boolean, or URIs. Simple-type elements have no attributes and don't contain any other elements. You can also create your own custom simple type, using an existing simple type as a base.