517. XML Schema
Version 1.0.6

Book cover

This course gives the student who knows the fundamentals of XML a detailed introduction to the XML Schema standard for defining document type information.

The first module introduces the new XML Schema recommendation. Students review the shortcomings of the DTD for expressing type information, and learn how to use XML Schema to create strict document models. Schema data types and structures are studied, allowing precise grammar and validation rules to be defined for document content.

A second module offers intermediate-to-advanced instruction in effective use of the new XML Schema recommendation. Students build skills in use of keys and key references to associate elements based on key fields; cover complex-type extension; use of multiple namespaces and schema; and finally a chapter in best-practices in schema design.


  • A basic knowledge of XML, such as provided by Course 501.

Learning Objectives

  • Develop XML Schema to express precise type information for an XML document.
  • Associate schema with XML instance documents.
  • Validate instance documents against associated schema.
  • Define simple types, and use value restrictions and enumerations to constrain values.
  • Define list types and union types.
  • Create complex types, including simple types and other complex types, and empty- and mixed-content types.
  • Define element and attribute groups for better reuse and more maintainable schema.
  • Associate elements of different types using keys and key references.
  • Create derived simple and complex types using restriction and/or extension.
  • Develop hierarchies of reusable complex types using type extension.
  • Populate multiple namespaces using schema, and import and use those namespaces in valid instance documents.
  • Design schema that maximize validation capabilities and type reuse.
  • Use XSLT as an additional stage of document validation, to catch patterns that XML Schema cannot be used to express.

Timeline: 2 days.

Module 1. Introduction to XML Schema

Chapter 1. Getting Started with XML Schema

  • What is an XML schema?
  • Schemas vs. DTDs
  • Structure of a Schema
  • Associating Schema with Documents
  • Types of Types
  • Defining Elements
  • Defining Complex Types
  • Validation

Chapter 2. Simple Types

  • Simple and Atomic Types
  • Built-In Types
  • Primitives
  • Numeric Derived Types
  • String Derived Types
  • Simple Type Restriction
  • Facets
  • Enumerations
  • Patterns
  • Lists
  • Unions
  • Nillable Values

Chapter 3. Complex Types

  • Model Groups
  • Sequences, Conjunctions, and Disjunctions
  • Particles
  • Occurrence Constraints
  • Global and Local Definitions
  • Defining Attributes
  • Empty, Any, and Mixed Content
  • Model Group Definitions
  • Attribute Group Definitions
  • Annotations

Module 2. Advanced XML Schema

Chapter 1. Keys and Key References

  • Schema as Object Models
  • UML for XML
  • Composition
  • Association
  • Identity Constraints
  • Asserting Uniqueness
  • Keys and Key References
  • Controlling Association Cardinality

Chapter 2. Reusing Schema Types

  • Type Specialization
  • Extending Complex Types
  • Using Extended Types
  • Derivation by Restriction
  • Abstract Types
  • Substitution Groups
  • "Complete" Specialization (The final Attribute)

Chapter 3. Namespaces and Schema

  • Using Namespaces in Documents
  • Populating a Namespace
  • Qualified and Unqualified Locals
  • Multiple Namespaces in Schema
  • Importing and Including Schema
  • Multiple Schema per Namespace
  • Validating by Namespace (Wildcards)

Chapter 4. Using Schema in XML Applications

  • Schema Design Issues
  • Type Granularity
  • Ease of Parsing, Transformation, Presentation and Maintenance
  • Mapping from Object Models
  • Mapping from Database Schema
  • Foreign-Key Relationships
  • XSLT for Validation
  • Application Validation

Appendix A. Learning Resources

System Requirements

Hardware Requirements (Minimum) 200 MHz, 128 meg RAM, 50 meg disk space.
Hardware Requirements (Recommended) 500 MHz, 256 meg RAM, 50 meg disk space.
Operating System Tested on Windows XP Professional. Course software should be viable on all systems which support W3C-compliant XML tools.
Network and Security Limited privileges required -- please see our standard security requirements.
Software Requirements All free downloadable tools.