Name

xs:import — Import of a W3C XML Schema for another namespace.

Synopsis

<xs:import
           id               = xs:ID
           namespace        = xs:anyURI
           schemaLocation   = xs:anyURI
           {any attributes with non-schema namespace}
           >
           Content: (xs:annotation?)
</xs:import>

May be included in: xs:schema

Description

xs:import identifies the location at which a W3C XML Schema validator may find the definition corresponding to namespaces other than the target namespace of the current schema.

All the global definitions (elements, attributes, element and attribute groups, simple and complex types) and unique and key constraints of the imported schemas can be referenced using a namespace prefix defined for the corresponding namespace URI.

The schema locations indicated in xs:import elements are only hints provided to the schema validators and may be omitted. In this case, the Recommendation states that “the schema author is leaving the identification of that schema to the instance, application or user, via the mechanisms described in Layer 3: Schema Document Access and Web-interoperability.”

xs:import may also be used to import components with no target namespaces into schemas with target namespaces.

Restrictions

xs:import must not be used to import component definitions from the target namespace since two other elements are available for this purpose (see xs:include and xs:redefine ).

Only global component definitions of the imported schemas can be referenced (local definitions can never be referenced).

The rules of scoping described ...

Get XML Schema now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.