Schemat XML zawiera element
❮ Pełne odniesienie do schematu XML
Definicja i użycie
Element include służy do dodawania do dokumentu wielu schematów z tą samą docelową przestrzenią nazw.
Informacje o elemencie
- Elementy nadrzędne: schemat
Składnia
<include
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
(Znak ? deklaruje, że element może wystąpić zero lub jeden raz wewnątrz elementu include)
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 |
Przykład 1
W przypadku dołączonych schematów wszystkie dołączone pliki muszą odwoływać się do tej samej docelowej przestrzeni nazw. Jeśli docelowa przestrzeń nazw schematu nie jest zgodna, dołączanie nie będzie działać:
<?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>
❮ Pełne odniesienie do schematu XML