xsd_example

ComplexType

  <xsd:complexType name="xxx">
      <xsd:sequence>
          <xsd:element name="ooo" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
  </xsd:complexType>

<!--  ex: <xxx><ooo>aaaa</ooo></xxx> -->

Element with only text and attribute

  <xsd:complexType name="ooo">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute name="zzz" type="xsd:integer"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

<!--  ex: <ooo zzz="123">aaaa</ooo> -->

Element with mutual exclusive sub-element

<xsd:complexType name="ooo">
  <xsd:sequence>
       <xsd:element name="maximum-length" type="xsd:integer" minOccurs="0" maxOccurs="1"/>
      <xsd:choice minOccurs="0" maxOccurs="1">
          <xsd:element name="default" type="xsd:string" />
          <xsd:element name="defaults" type="xsd:integer" />
      </xsd:choice>
  </xsd:sequence>
</xsd:complexType>

<!-- ex: 
    <ooo><maximum-length>12</maximum-length><default>aaa</default></ooo>
or <ooo><defaults>123</defaults></ooo>
-->

SimpleType

  <xsd:simpleType name="labelMode">                                                                                                                                                                            
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="none"/>
      <xsd:enumeration value="top"/>
      <xsd:enumeration value="left"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="string-first-char-alpha">
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[a-zA-Z].*"/>                                                                                                                                                                          
    </xsd:restriction>
  </xsd:simpleType>
xml
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License