Skip to Main Content
XML Schema
book

XML Schema

by Eric van der Vlist
June 2002
Intermediate to advanced content levelIntermediate to advanced
396 pages
11h 8m
English
O'Reilly Media, Inc.
Content preview from XML Schema

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XML in a Nutshell, 3rd Edition

XML in a Nutshell, 3rd Edition

Elliotte Rusty Harold, W. Scott Means
Beginning XML, 5th Edition

Beginning XML, 5th Edition

Danny Ayers, Liam R.E. Quin, Joe Fawcett
XML Schema Complete Reference, The

XML Schema Complete Reference, The

Cliff Binstock, Chris Galtenberg, Mike Wooding, Chris Dix, Mitchell Smith, Dave Peterson
Programming Web Services with SOAP

Programming Web Services with SOAP

James Snell, Doug Tidwell, Pavel Kulchenko

Publisher Resources

ISBN: 0596002521Supplemental ContentErrata Page