Imports

A schema can 'import' definitions from other schemas. Unlike the inclusion and re-definition features described above, this technique copes well with external schema documents that have different target namespaces.

The Import element calls in the other schema, using the Namespace attribute to identify the namespace targeted by the other schema and the SchemaLocation attribute to physically locate the other schema file (using a URL reference):

<import namespace="file:///d:/ns/namesSchema"
        schemaLocation="file:///d:/schema/names.xsd" />

The SchemaLocation attribute is optional, because the XML Schema parser may have other ways to locate other schemas. The Namespace attribute is also optional, because the schema may not have a target namespace. ...

Get XML Companion, The, Third Edition 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.