xml - XSD Schema - Sequence and List for checkboxes -
i got small confusion xsd schema. need cover checkboxes (i.e. multiple values per element). see below:
[1]
<xsd:element name="parent"> <xsd:complextype> <xsd:sequence> <xsd:element maxoccurs="2" minoccurs="0" name="children"> <xsd:complextype> <xsd:sequence> <xsd:element name="child" type="xsd:string"> . . this means can have:
<parent> <children> <child /> </children> <children> <child /> </children> </parent> now can same defined , achieved <xsd:list>? this:
<xsd:element name="parent"> <xsd:complextype> <xsd:sequence> <xsd:element name="children"> <xsd:simpletype> <xsd:list> <xsd:simpletype> <xsd:restriction base="xsd:string"> <xsd:enumeration value="child 1"/> <xsd:enumeration value="child 2"/> </xsd:restriction> </xsd:simpletype> </xsd:list> </xsd:simpletype> </xsd:element> so, overall bit confused between xsd:list , minoccurs/maxoccurs.
the xsd:list element defines possible values, not possible child elements - second example defines element children has valid content space-separated list of strings child 1 , child 2 - i.e. xml this:
<parent> <children>child 1</children> </parent> or
<parent> <children>child 2</children> </parent> or
<parent> <children>child 1 child 2</children> </parent> note values in list defined xsd:list space-separated, should not contain spaces.
Comments
Post a Comment