XSD Tutorials - Herong's Tutorial Examples - Version 5.11, by Dr. Herong Yang
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.
Last update: 2013.
Table of Contents