XML Schema restriction উপাদান
পরিভাষা ও ব্যবহার
restriction উপাদানটি সিম্পলType, simpleContent বা complexContent নির্দিষ্ট করে নির্বাচন নির্দিষ্ট করে।
উপাদান তথ্য
উপস্থিতির সংখ্যা | একবার |
পিতৃ উপাদান | complexContent |
কনটেন্ট | group, all, choice, sequence, attribute, attributeGroup, anyAttribute |
ভাষা
<restriction id=ID base=QName অন্য বৈশিষ্ট্য > simpleType এর জন্য কনটেন্ট: (annotation?,(simpleType?,(minExclusive|minInclusive| maxExclusive|maxInclusive|totalDigits|fractionDigits| length|minLength|maxLength|enumeration|whiteSpace|pattern)*)) simpleContent এর জন্য কনটেন্ট: (annotation?,(simpleType?,(minExclusive |minInclusive| maxExclusive|maxInclusive|totalDigits|fractionDigits| (length|minLength|maxLength|enumeration|whiteSpace|pattern)*)?, ((attribute|attributeGroup)*,anyAttribute?)) complexContent এর জন্য কনটেন্ট: (annotation?,(group|all|choice|sequence)?, ((attribute|attributeGroup)*,anyAttribute?)) </restriction>
(? সংকেত রিস্ট্রিকশন উপাদানে এই উপাদানটির কোনও সময় বা একবার উপস্থিত হতে পারে)。
বৈশিষ্ট্য | বর্ণনা |
---|---|
id | অপশনাল।এই উপাদানের অভিন্ন ID নির্দিষ্ট করুন。 |
বেস | অপরিহার্য।এই schema (বা নির্দিষ্ট নামকরণসম্পত্তির দ্বারা ইন্দ্রণীয় schema) তে নির্দিষ্ট বৈশিষ্ট্য নাম, simpleType বা complexType উপাদানগুলির নাম নির্দিষ্ট করুন。 |
অন্য বৈশিষ্ট্য | অপশনাল।নন-স্কেমা নামকরণসম্পত্তির অন্য কোনও বৈশিষ্ট্য নির্দিষ্ট করুন。 |
প্রদর্শন
উদাহরণ 1
নিম্নলিখিত উদাহরণটিতে একটি বাধ্যতামূলক ও "age" নামক উপাদান নির্দিষ্ট করা হয়েছে। age-এর মান ০ থেকে ১০০-র মধ্যে হতে হবে:
<xs:element name="age"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="100"/> </xs:restriction> </xs:simpleType> </xs:element>
উদাহরণ 2
এই উদাহরণটিতে "initials" নামক একটি উপাদান নির্দিষ্ট করা হয়েছে। "initials" উপাদানটি একটি বাধ্যতামূলক সরল ধরন। স্বীকৃত মান হলো তিনটি a থেকে z-র মধ্যে বড় বা ছোট অক্ষর:
<xs:element name="initials"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[a-zA-Z][a-zA-Z][a-zA-Z]"/> </xs:restriction> </xs:simpleType> </xs:element>
উদাহরণ 3
এই উদাহরণটিতে "password" নামক একটি উপাদান নির্দিষ্ট করা হয়েছে। "password" উপাদানটি একটি বাধ্যতামূলক সরল ধরন। মান ৫ থেকে ৮ ইংরেজি অক্ষরের মধ্যে হতে হবে:
<xs:element name="password"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="5"/> <xs:maxLength value="8"/> </xs:restriction> </xs:simpleType> </xs:element>
উদাহরণ 4
এই উদাহরণটিতে একটি বাধ্যতামূলক জটিল ধরন নির্দিষ্ট করা হয়েছে। জটিল ধরন "Chinese_customer" একটি সাধারণ "customer" জটিল ধরন থেকে উদ্ভূত হয়েছে, তার country উপাদানের স্থায়ী মান "China":
<xs:complexType name="customer"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="Chinese_customer"> <xs:complexContent> <xs:restriction base="customer"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:element name="country" type="xs:string" fixed="China"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType>