XML Schema include要素
完全なXML Schemaリファレンスマニュアル
定義と使い方
include要素は、同じターゲット名前空間を持つ複数のスキーマをドキュメントに追加するために使用されます。
要素情報
- 親要素: schema
構文
<include
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
(? 記号はinclude要素内で宣言され、この要素は0回または1回出現できます。)
| 属性 | 説明 |
|---|---|
| id | 任意。この要素の一意のIDを指定します。 |
| schemaLocation | 必須。含む側のスキーマのターゲット名前空間内で、含まれるスキーマのURIを指定します。 |
| any attributes | 任意。non-schema名前空間を持つその他の属性を指定します。 |
例 1
含まれるスキーマにより、含まれるファイルはすべて同じターゲット名前空間を参照する必要があります。スキーマのターゲット名前空間が一致しない場合、インクルードは有効になりません:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.example.com/schema">
<xs:include schemaLocation="https://www.example.com/schema/customer.xsd"/>
<xs:include schemaLocation="https://www.example.com/schema/company.xsd"/>
..
..
..
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.example.com/schema">
<xs:include schemaLocation="https://www.example.com/schema/customer.xsd"/>
<xs:include schemaLocation="https://www.example.com/schema/company.xsd"/>
..
..
..
</xs:schema>
完全なXML Schemaリファレンスマニュアル その他の拡張