xsd - How to declare a complexType has only one child element? -
when using xml schema declare complextype has 1 child element, below 3 approaches achieve goal:
<xs:complextype> <xs:sequence> <xs:element ref="somevalue"/> </xs:sequence> </xs:comlextype> <xs:complextype> <xs:choice> <xs:element ref="somevalue"/> </xs:choice> </xs:comlextype> <xs:complextype> <xs:all> <xs:element ref="somevalue"/> </xs:all> </xs:comlextype> apparently, sequence, choice , all not necessary single element, because should used indicate order of multiple elements. is there more concise way declare complextype has 1 child element? (i.e. 1 eliminates use of sequence, all or choice, somehow.)
just eliminating xs:sequence, xs:choice, or xs:all, not option:
<xs:complextype name="ctype"> <xs:element name="e"/> </xs:complextype> is not valid.
see xml representation of complex type definitions complextype's content model defined follows:
(annotation?, (simplecontent | complexcontent | ((group | | choice | sequence)?, ((attribute | attributegroup)*, anyattribute?))))
there no provision element being direct child of complextype.
Comments
Post a Comment