XML Schema zawierać elementy
Definicja i Wykorzystanie
include służy do dodawania wielu schematu z tym samym docelowej przestrzeni nazw do dokumentu.
Element informacji
- Parent Element: schema
gramatyka
<include
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
(? Znak deklaruje, że to element, element może wystąpić zero lub jeden raz).
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
schemaLocation | 必需。规定在包含 schema 的目标命名空间中,要包括的 schema 的 URI。 |
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
Przykład 1
Przez zostały ujęte w schemacie, plik musi być zawarte we wszystkich odniesień do tej samej przestrzeni nazw docelowej. Jeżeli nazw docelowy schemat nie pasuje, to nie będzie skuteczne to:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3cschool.cc/schema">
<xs:include schemaLocation="http://www.w3cschool.cc/schema/customer.xsd"/>
<xs:include schemaLocation="http://www.w3cschool.cc/schema/company.xsd"/>
..
..
..
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3cschool.cc/schema">
<xs:include schemaLocation="http://www.w3cschool.cc/schema/customer.xsd"/>
<xs:include schemaLocation="http://www.w3cschool.cc/schema/company.xsd"/>
..
..
..
</xs:schema>
Kompletna XML Schema Reference