XML Schema import element

Definition and Usage

The import element is used to add multiple schemas with different target namespaces to a document.

Element Information

Occurrence Unrestricted
Parent Element schema
Content annotation

Syntax

<import
id=ID
namespace=anyURI
schemaLocation=anyURI
any attributes
>
(annotation?)
</import>
Attributes Description
id Optional. Specifies a unique ID for the element.
namespace Mandatory. Specifies the URI of the namespace to be imported.
schemaLocation Optional. Specifies the URI of the imported namespace.
any attributes Optional. Specifies any other attributes with non-schema namespaces.

(The ? symbol declaration is in the import element, which can appear zero or one time.)

Example

The following example shows how to import a namespace:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.codew3c.com/schema"/>
..
..
..
</xs:schema>