XMLスキーマには要素が含まれます
❮完全なXMLスキーマリファレンス
定義と使用法
include要素は、同じターゲット名前空間を持つ複数のスキーマをドキュメントに追加するために使用されます。
要素情報
- 親要素:スキーマ
構文
<include
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
(?記号は、要素がinclude要素内で0回または1回発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
schemaLocation | Required. Specifies the URI to the schema to include in the target namespace of the containing schema |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例1
インクルードされたスキーマでは、インクルードされたファイルはすべて同じターゲット名前空間を参照する必要があります。スキーマターゲットの名前空間が一致しない場合、インクルードは機能しません。
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com/schema">
<xs:include schemaLocation="https://www.w3schools.com/xml/customer.xsd"/>
<xs:include schemaLocation="https://www.w3schools.com/xml/company.xsd"/>
..
..
..
</xs:schema>
❮完全なXMLスキーマリファレンス