Schema Component Reuse - "include", "redefine" or "import"

This section compares 3 different ways of linking multiple schema documents together: include, redefine and import.

XML Schema specification offers 3 different special components to link multiple schema definition documents together for different purposes:

1. "include" Component - This component brings all declarations and definitions of an external schema document into the current schema. The external schema document must have the same target namespace as the current schema. "include" components are usually used to build a new schema by extending existing schema documents.

2. "redefine" Component - This component offers the same functions as the "include" component. But a "redefine" component also allows you redefine some datatypes provided in the included schema document. "redefine" components are usually used to revise a schema by redefining datatype definitions of existing schema documents.

3. "import" Component - This component offers the same functions as the "include" component except that the included schema document has a different target namespace. "import" components are usually used to build a new schema by borrowing element declarations from existing schema documents from other namespaces.

XML representations of "include", "redefine" and "import" components must appear at the beginning of a schema document before any element declarations or type definitions.

Tutorial examples of "include", "redefine" and "import" components are provided in other sections of this chapter.

Table of Contents

 About This Book

 Introduction to XML Schema

 XML Editor and Schema Processor - XMLPad

 Java API for XML Processing - JAXP

 JAXP - XML Schema (XSD) Validation

 Xerces2 Java Parser - Java API of XML Parsers

 Using Xerces2 Java APIs

 XML Schema Language - Basics

 Introduction of XSD Built-in Datatypes

 "string" and Its Derived Datatypes

 "decimal" and Its Derived Datatypes

 "dateTime" and Its Related Datatypes

 Miscellaneous Built-in Datatypes

 Facets, Constraining Facets and Restriction Datatypes

 "simpleType" - Defining Your Own Simple Datatypes

 Complex Element Declaration

 Identity-Constraints: unique, key and keyref

 Assertion as Custom Validation Rules

 XML Schema Location and Namespace in XML Documents

 Overriding Element Types in XML Documents

Linking Multiple Schema Documents Together

Schema Component Reuse - "include", "redefine" or "import"

 Including Old Schema Documents - "include" Component

 Including Old Schema Documents - Examples

 Including Old Schema Documents - Errors

 Redefining Old Datatypes - "redefine" Component

 Redefining Old Datatypes - XML Examples

 Redefining Old Datatypes - Errors

 Importing Declarations Across Namespaces - "import" Component

 Importing Declarations Across Namespaces - Examples

 Using Elements Declared in Different Namespaces

 Using Elements Declared in Different Namespaces - Errors

 Glossary

 Archived Tutorials

 References

 Full Version in PDF/EPUB