xsd - Is this the proper way to added enumerated attributes to a complexType? -
is proper way set attribute enumerated values on complextype availstatusmessagetype
. see lot of examples declare complexcontent section right below complextype declaration? complexcontent , necessary here?
<xs:complextype name="availstatusmessagetype"> <xs:sequence> <xs:element name="lengthsofstay" type="lengthsofstaytype" /> <xs:element name="restrictionstatus" type="restrictionstatustype"/> </xs:sequence> <xs:attribute name="bookinglimit"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="setlimit" /> <xs:enumeration value="adjustlimit"/> <xs:enumeration value="removelimit"/> </xs:restriction> </xs:simpletype> </xs:attribute> </xs:complextype>
element types can divided 2 categories in xml schemas
- elements can contain structural markup (attributes or child elements)
- elements contain textual markup
further, elements contain markup (group 1) can again divided 2 groups
- elements allowed have child elements
- elements not allowed have child elements
first division separates (1) <complextype>
, (2) <simpletype>
. second 1 separates (1) <complexcontent>
, (2) <simplecontent>
.
<xs:complexcontent>
not seen, because implicit default whole structure can abbreviated omitting element. common structure
<xs:complextype> ... (<xs:sequence> or anything) ... </xs:complextype>
is identical to
<xs:complextype> <xs:complexcontent> <xs:restriction base="xs:anytype"> ... (<xs:sequence> or anything) ... </xs:restriction> </xs:complexcontent> </xs:complextype>
in structure element type "availstatusmessagetype" 1) contains markup 2) , has child elements. structure complex type complex content. example seems correct though haven't used <xs:complexcontent>
element, because using abbreviated form. identical this:
<xs:complextype name="availstatusmessagetype"> <xs:complexcontent> <xs:restriction base="xs:anytype"> <xs:sequence> <xs:element name="lengthsofstay" type="lengthsofstaytype" /> <xs:element name="restrictionstatus" type="restrictionstatustype"/> </xs:sequence> <xs:attribute name="bookinglimit"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="setlimit" /> <xs:enumeration value="adjustlimit"/> <xs:enumeration value="removelimit"/> </xs:restriction> </xs:simpletype> </xs:attribute> </xs:restriction> </xs:complexcontent> </xs:complextype>
Comments
Post a Comment