As schemas become larger, it is often desirable to divide their content among several schema documents for purposes such as ease of maintenance, reuse, and readability. XML schema defines two constructs to support this: include and import. The include element brings in definitions and declarations from the included schema into the current schema. It requires the included schema to be in the same target namespace as the including schema. The import element behaves in a similar way, with the exception that the imported schema can come from a different namespace.
In the XML schema editor, you can add an include element to an XML schema. Before you can do this, you must create an XML schema and open it in the XML schema editor (you can open an XML schema in the XML schema editor by double-clicking it).
The following instructions were written for the XML perspective, but they will also work in many other perspectives.
To add an include element , follow these steps:
Once you have added the include element to your XML schema, when you define new elements, attributes, complex types, or simple types where you can specify type information, any declarations from the included schema will be available in the Type list for the element, attribute, complex or simple type.
For example, if Address.xsd has the following content:
<complexType name="Address"> <sequence> <element name="name" type="string"> <element name="street" type="string"> </sequence> </complexType>and you have an XML schema called PurchaseOrder.xsd that has added an include for Address.xsd, then when defining a new element in PurchaseOrder, you can select Address as its type.
(c) Copyright 2001, World Wide Web Consortium (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University).
Related tasks
Adding an import element
Adding a redefine element
Related reference
XML namespaces
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.