Name
xs:include — Inclusion of a W3C XML Schema for the same target namespace.
Synopsis
<xs:include id = xs:ID schemaLocation = xs:anyURI {any attributes with non-schema namespace} > Content: (xs:annotation?) </xs:include>
May be included in: xs:schema
Description
xs:include
performs a straight inclusion of a
schema within another schema that describes the same target
namespace. It is possible, though, to include a schema that
doesn’t specify a target namespace. The included
schema will be treated as adopting the target namespace of its
includer in a schema with a target namespace. This possibility, often
called “chameleon design,” allows
reuse of “transparent” schemas in
the context of different namespaces.
The effect of a schema inclusion is a merge between the two schemas that are consolidated into a global schema. The schema that is included doesn’t need to be a complete schema by itself.
Restrictions
It is not possible to use xs:include
to include a
schema describing another namespace. (xs:import
should be used in this case.)
It is not possible to change the definitions of the included schemas.
(xs:redefine
should be used in this case.)
It is not possible to include a fragment of a schema. (General
purpose inclusion mechanisms such as XInclude
should be used in this case.)
Example
<xs:include schemaLocation="simple-types.xsd"/>
Attributes
-
id
W3C XML Schema’s element ID.
-
schemaLocation
Location of the schema to include.
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.