องค์ประกอบ XML Schema redefine
การกำหนดและการใช้งาน
redefine องค์ประกอบมีความสามารถในการกำหนดรูปแบบของสรีระและทรรกภาพที่กำหนดด้วย external schema file ซึ่งเป็น type, group และ attributeGroup
ข้อมูลขององค์ประกอบ
ความเกิดขึ้นของ | ไม่จำกัด |
ตัวปล่อย | schema |
เนื้อหา | annotation จาก attributeGroup จาก complexType จาก group จาก simpleType |
วลี
<redefine id=ID schemaLocation=anyURI attributes ใดๆ > (annotation|(simpleType|complexType|group|attributeGroup))* </redefine>
attribute | การอธิบาย |
---|---|
id | ตัวเลือกตามที่กำหนด。กำหนด ID ที่เป็นเดียวเดียวขององค์ประกอบ |
schemaLocation | จำเป็นต้องมี URI การอ้างอิงตำแหน่งของเอกสาร schema |
attributes ใดๆ | ตัวเลือกตามที่กำหนด。กำหนดแนวทางใดๆ ของ attribute ที่มี namespace ที่ไม่ใช้ schema |
ตัวอย่าง
ตัวอย่าง 1
Myschema2.xsd ตัวอย่างแสดงสคริปต์ schema ที่มี Myschama1.xsd กำหนดรูปแบบขององค์ประกอบ pname ที่ถูกกำหนดใหม่。ตาม schema นี้ องค์ประกอบที่ถูก pname จำกัดต้องสิ้นสุดด้วยองค์ประกอบ "country":
Myschema1.xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="pname"> <xs:sequence> <xs:element name="firstname"/> <xs:element name="lastname"/> </xs:sequence> </xs:complexType> <xs:element name="customer" type="pname"/> </xs:schema>
Myschema2.xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:redefine schemaLocation="Myschema1.xsd"> <xs:complexType name="pname"> <xs:complexContent> <xs:extension base="pname"> <xs:sequence> <xs:element name="country"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="author" type="pname"/> </xs:schema>