XSD သည် <anyAttribute> Element ဖြစ်သည်။
<anyAttribute> ဒြပ်စင်သည် ကျွန်ုပ်တို့အား schema မှမသတ်မှတ်ထားသော အရည်အချင်းများဖြင့် XML စာရွက်စာတမ်းကို တိုးချဲ့နိုင်စေပါသည်။
<anyAttribute> ဒြပ်စင်
<anyAttribute> ဒြပ်စင်သည် ကျွန်ုပ်တို့အား schema မှမသတ်မှတ်ထားသော ရည်ညွှန်းချက်များဖြင့် XML စာရွက်စာတမ်းကို တိုးချဲ့နိုင်စေပါသည်။
အောက်ပါဥပမာသည် "family.xsd" ဟုခေါ်သော XML schema မှအပိုင်းအစဖြစ်သည်။ ၎င်းသည် "ပုဂ္ဂိုလ်" ဒြပ်စင်အတွက်ကြေငြာချက်ကိုပြသသည်။ <anyAttribute> ဒြပ်စင်ကို အသုံးပြုခြင်းဖြင့် ကျွန်ုပ်တို့သည် "လူ" ဒြပ်စင်သို့ မည်သည့် attribute အရေအတွက်ကိုမဆို ထည့်နိုင်သည်-
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
<xs:anyAttribute/>
</xs:complexType>
</xs:element>
ယခု ကျွန်ုပ်တို့သည် "လူ" ဒြပ်စင်အား "မျက်လုံးအရောင်" ရည်ညွှန်းချက်ဖြင့် တိုးချဲ့လိုပါသည်။ ဤအခြေအနေတွင် အထက်ဖော်ပြပါ schema ၏ရေးသားသူသည် မည်သည့် " eyecolor" attribute ကိုမျှ မကြေငြာခဲ့လျှင်ပင်၊
"attribute.xsd" ဟုခေါ်သော ဤ schema ဖိုင်ကိုကြည့်ပါ-
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">
<xs:attribute name="eyecolor">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="blue|brown|green|grey"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:schema>
အောက်ပါ XML ဖိုင် ("Myfamily.xml" ဟုခေါ်သည်)၊ မတူညီသော အစီအစဉ်နှစ်ခုမှ အစိတ်အပိုင်းများကို အသုံးပြုသည်။ "family.xsd" နှင့် "attribute.xsd":
<?xml version="1.0" encoding="UTF-8"?>
<persons xmlns="http://www.microsoft.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.microsoft.com family.xsd
https://www.w3schools.com attribute.xsd">
<person eyecolor="green">
<firstname>Hege</firstname>
<lastname>Refsnes</lastname>
</person>
<person eyecolor="blue">
<firstname>Stale</firstname>
<lastname>Refsnes</lastname>
</person>
</persons>
schema "family.xsd" သည် "person" ဒြပ်စင်သို့ ရည်ညွှန်းချက်တစ်ခု ထည့်နိုင်သောကြောင့် အထက်ဖော်ပြပါ XML ဖိုင်သည် မှန်ကန်ပါသည်။
<any> နှင့် <anyAttribute> ဒြပ်စင်များကို အကျယ်တဝင့်ပြုလုပ်ရန် အသုံးပြုပါသည်။ ၎င်းတို့သည် စာရွက်စာတမ်းများတွင် ပင်မ XML အစီအစဉ်တွင် မကြေငြာထားသော အပိုဒြပ်စင်များပါရှိသည်။