␡
- XML Schema: An Overview
- Element and Attribute Declarations
- Types
- Namespaces
- Multiple Schema Documents
- Specifying a Schema Location
- Additional Features
Like this article? We recommend
Multiple Schema Documents
Schemas can be composed of one or more XML documents. These schema documents can be explicitly joined together using the include and import elements. An include element is used when both schema documents have the same target namespace, whereas an import element is used when they have different target namespaces. Example 7 shows the use of both include and import.
Example 7. Joining Multiple Schema Documents
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://example.org/emp" targetNamespace="http://example.org/emp"> <xsd:include schemaLocation="EmployeeDetail.xsd"/> <xsd:import namespace="http://example.org/payroll" schemaLocation="payroll.xsd"/> <!--...--> </xsd:schema>