เอลิเมนต์ redefine ของ XML Schema
การกำหนดและการใช้งาน
เอลิเมนต์ redefine อนุญาตให้กำหนดประเภทที่เรียบง่ายและที่ซับซ้อน กลุ่ม และกลุ่มแอตทริบิวต์ที่ได้รับมาจากเอกสารสร้างสคีมาชาตร์นอก
ข้อมูลเอลิเมนต์
จำนวนการปรากฏตัว | ไม่จำกัด |
เอลิเมนต์พ่อ | schema |
เนื้อหา | annotation、attributeGroup、complexType、group、simpleType |
วลี
<redefine id=ID schemaLocation=anyURI แอตทริบิวต์ที่มีอยู่ > (annotation|(simpleType|complexType|group|attributeGroup))* </redefine>
แอตทริบิวต์ | รายละเอียด |
---|---|
id | ใหญ่. กำหนด ID แห่งประกายนี้ |
schemaLocation | จำเป็น. อ้างอิง URI ของตำแหน่งของเอกสาร schema |
แอตทริบิวต์ที่มีอยู่ | ใหญ่. กำหนดรายละเอียดของรายการอื่นที่มีชื่อสาขาแบบ non-schema |
ตัวอย่าง
ตัวอย่าง 1
ตัวอย่างดังนี้แสดงสคีมาชาตร์หนึ่ง Myschama2.xsd ซึ่งมีอยู่ประกายแบบที่กำหนดโดย Myschama1.xsd มีอยู่ประกาย. ประเภท pname ถูกกำหนดใหม่. ตามสคีมาชาตร์นี้ ประกายที่ถูกกำหนดโดย 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:element name="country"/> </xs:complexContent> <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:element name="country"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> </xs:schema>