|
Home > Online Product Documentation > Table of Contents > Ways to Reference XML Schemas Ways to Reference XML SchemasThere are three ways to reference XML Schema: This section describes each of these techniques and how they can be used. In these descriptions, we use the term referenced XML Schema to indicate the XML Schema that is being included, imported, or redefined; and base XML Schema to indicate the XML Schema in which the referenced schema is being included, imported, or redefined. Including an XML Schema
When reference an XML Schema by
including it, the included XML Schema augments the base XML Schema. Both documents are effectively combined, and they both define the same XML Schema. complexTypes defined in the included XML Schema can be used as the base for new types - you might use a
Importing an XML SchemaWhen you reference an XML Schema by importing it, the base XML Schema and the imported XML Schema must have difference namespaces. The base XML Schema can the reference parts of the imported XML schema using a prefix whose namespace is defined in the imported XML Schema, for example. You can import multiple XML Schemas in a base XML Schema. Redefining an XML SchemaReferencing an XML Schema by redefining it is similar to including it, with one important difference: when you redefine an XML Schema in the base XML Schema, you can redefine the definitions of the referenced XML Schema's complexTypes, simpleTypes, groups, and attributeGroups. For example, suppose you release version 1 of an XML Schema. When you need to release version 2 of the XML Schema, you can reference version 1 by redefining it in version 2, which allows you to change the definition of a given node to include a new attribute. The original complexTypes, simpleTypes, groups, and attributeGroups in the redefined XML Schema are completely masked. They are redefined using extensions and restrictions. An extension extends the base type - declaring a new element, for example. A restriction constrains the base type. |