XML Schema รวมถึงองค์ประกอบ
ความหมายและการใช้งาน
องค์ประกอบรวมถึงถูกนำมาใช้เพื่อเพิ่มสคีหลายกับ namespace เป้าหมายเดียวกันกับเอกสาร
องค์ประกอบข้อมูล
- องค์ประกอบหลัก: สคี
ไวยากรณ์
<include
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
(ใช่หรือไม่ลงบอกว่ามีองค์ประกอบองค์ประกอบสามารถเกิดขึ้นได้เป็นศูนย์หรือเพียงครั้งเดียว.)
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
schemaLocation | 必需。规定在包含 schema 的目标命名空间中,要包括的 schema 的 URI。 |
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
ตัวอย่างที่ 1
โดยถูกรวมอยู่ในคีไฟล์ต้องรวมอยู่ในการอ้างอิงถึง namespace ที่เป้าหมายเดียวกัน ถ้า namespace เป้าหมายคีมาไม่ตรงกันมันจะไม่เป็นที่มีประสิทธิภาพรวมถึง:
<?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>
XML Schema สมบูรณ์อ้างอิง