element include ของ XML Schema
การกำหนดและการใช้งาน
element include ใช้เพื่อเพิ่ม schema ที่มี namespace หน้าเดียวกันกับเอกสาร
ข้อมูล element
การปรากฏของ element | ไม่จำกัด |
parent element | schema |
content | annotation |
grammer
<include id=ID schemaLocation=anyURI attributes ทุกตัว > (annotation?) </include>
attributes | คำอธิบาย |
---|---|
id | เลือกตั้ง |
schemaLocation | จำเป็น |
attributes ทุกตัว | เลือกตั้ง |
(? สัญญาณการระบุแสดงใน element include ซึ่งสามารถปรากฏขึ้น 0 ครั้ง หรือ 1 ครั้ง。)
ตัวอย่าง
ผ่านทาง schema ที่ถูกรวมเข้ามา ไฟล์ที่ถูกรวมเข้ามาต้องเรียกใช้ namespace หน้ามาด้วยทั้งหมด ถ้า namespace ของ schema ไม่ตรงกัน การรวมจะไม่มีผล:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.codew3c.com/schema"> <xs:include schemaLocation="http://www.codew3c.com/schema/customer.xsd"/> <xs:include schemaLocation="http://www.codew3c.com/schema/company.xsd"/> .. .. .. </xs:schema>