XML Schema extension အရာ

အဆိုပါကြောင်းအရာ အသုံးပြုခြင်း နှင့် အသုံးပြုခြင်း

extension အရာများ simpleType သို့မဟုတ် complexType အရာများ အထူးသတင်းပေးသည်。

အကျယ်ပြန့်အချက်

ပေါ်ပေါက်စဉ် တက်ရိုး
အဖွဲ့အစိုးရ complexContent
အရေးပါသောအချက် annotation、attribute、attributeGroup、anyAttribute、choice、all、sequence、group

ကြည့်သတင်း

<extension
id=ID 
base=QName
any attributes
>
(annotation?,((group|all|choice|sequence)?,
((attribute|attributeGroup)*,anyAttribute?)))
</extension>
အချက်အလက် ဖော်ပြ
id လုံလောက်သည်။ အဆိုပါ အစိတ်အပိုင်း အတွက် ကိုယ်တိုင် ကိုယ်ချုပ် အမည် ကို ဖော်ပြပါတယ်。
base လိုအပ်သည်။ အဆိုပါ အကွင့်အသတ်သည် အဆိုပါ အစိတ်အပိုင်း ကို အသုံးပြုသည့် အမည် ကို ဖော်ပြပါတယ်。
xml:lang လုံလောက်သည်။ အသုံးပြုသည့် ဘာသာစကား ကို ဖော်ပြပါတယ်。

(? အမှတ်သတ်သည် အဆိုပါ extension အစိတ်အပိုင်း အတွင်းတွင် အသုံးပြုသည်။ အဆိုပါ အစိတ်အပိုင်း ကို တစ်ကြိမ် သို့မဟုတ် အများဆုံး တစ်ကြိမ် သာ အသုံးပြုနိုင်သည်။ * အမှတ်သတ်သည် အဆိုပါ အစိတ်အပိုင်း ကို အသုံးပြုနိုင်သည့် အရာ အများဆုံး တစ်ကြိမ် သို့မဟုတ် အများဆုံး အကြိမ် တစ်ကြိမ် သာ အသုံးပြုနိုင်သည်)

အမှတ်

အမှတ် 1

အောက်ပါ အကြောင်းအရာများ ကို အသုံးပြု၍ အထူး simpleType အစိတ်အပိုင်း ကို ဖွံ့ဖြိုးပေးပါတယ်:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="size">
  <xs:restriction base="xs:string">
    <xs:enumeration value="small" />
    <xs:enumeration value="medium" />
    <xs:enumeration value="large" />
  </xs:restriction>
</xs:simpleType>
<xs:complexType name="jeans">
  <xs:simpleContent>
    <xs:extension base="size">
      <xs:attribute name="sex">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="male" />
            <xs:enumeration value="female" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    
  </xs:simpleContent>


အမှတ် 2

အောက်ပါ အကြောင်းအရာများ ကို အသုံးပြု၍ အထူး complexType အစိတ်အပိုင်း ကို ဖွံ့ဖြိုးပေးပါတယ်:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employee" type="fullpersoninfo"/>
<xs:complexType name="personinfo">
  
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
  

<xs:complexType name="fullpersoninfo">