XML technologies / XML Schema / XML Schema element reference / xs:include

(Excerpt from “XML Schema” by Eric van der Vlist)

Inclusion of a W3C XML Schema for the same target namespace.

<xs:include
    id = xs:ID
    schemaLocation = xs:anyURI
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?)
</xs:include>

May occur within: xs:schema

Description

xs:include simply includes a schema within another describing the same target namespace. However, a schema specifying no target namespace can also be included. It is treated as adopting the target namespace of the including schema. This capability, often called “chameleon design”, allows reuse of “transparent” schemas in different namespaces.

Schema inclusion merges the two schemas into a consolidated global schema. The included schema need not be complete on its own.

Restrictions

It is not possible to use xs:include to include a schema describing another namespace. For that, use xs:import.

Definitions in included schemas cannot be changed. For that, use xs:redefine.

Including only a schema fragment is impossible. For that, use general-purpose inclusion mechanisms such as XInclude.

Example

<xs:include schemaLocation="simple-types.xsd"/>

Attributes

id
Element ID according to W3C XML Schema.

schemaLocation
Location of the schema to include.

   

 

 

 

back to top