XML Schema simpleContent Element
❮ การอ้างอิงสคีมา XML ที่สมบูรณ์
ความหมายและการใช้งาน
องค์ประกอบ simpleContent มีส่วนขยายหรือข้อจำกัดสำหรับประเภทที่ซับซ้อนแบบข้อความเท่านั้นหรือประเภทเรียบง่ายเป็นเนื้อหา และไม่มีองค์ประกอบ
ข้อมูลองค์ประกอบ
- องค์ประกอบหลัก: complexType
ไวยากรณ์
<simpleContent
id=ID
any attributes
>
(annotation?,(restriction|extension))
</simpleContent>
(เครื่องหมาย ? ประกาศว่าองค์ประกอบสามารถเกิดขึ้นได้เป็นศูนย์หรือครั้งเดียวภายในองค์ประกอบ simpleContent)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
ตัวอย่าง 1
นี่คือตัวอย่างขององค์ประกอบ XML (<shoesize>) ที่มีข้อความเท่านั้น:
<shoesize country="france">35</shoesize>
ตัวอย่างต่อไปนี้ประกาศ complexType "shoesize" โดยมีเนื้อหากำหนดเป็นประเภทข้อมูลจำนวนเต็มและมีแอตทริบิวต์ประเทศ:
<xs:element name="shoesize">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="country" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
❮ การอ้างอิงสคีมา XML ที่สมบูรณ์