XML Schema importElement


XML Schema 参考手册Complete XML Schema Reference Manual

Definition and Usage

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

Element Information

  • Parent element: schema

Syntax

<import
id=ID
namespace=anyURI
schemaLocation=anyURI
any attributes
>

(annotation?)

</import>

(The ? sign declares that the element can occur zero or one time within the import element.)

Attributes Description
id Optional. Specifies a unique ID for the element.
namespace Required. Specifies the URI of the namespace to import.
schemaLocation Optional. Specifies the URI of the imported namespace.
any attributes Optional. Specifies any other attributes with non-schema namespaces.

Example 1

The following example demonstrates importing a namespace:

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

<xs:import namespace="http://www.w3cschool.cc/schema"/>

..

..

..

</xs:schema>


XML Schema 参考手册Complete XML Schema Reference Manual Other extensions