Wednesday, April 15, 2015

examples of restrictions in XSDs

  1. <xs:element name="MyString" minOccurs="0">
       <xs:simpleType>
          <xs:restriction base="xs:string">
             <xs:pattern value="^[^a-z]+$"/>
             <xs:minLength value="1"/>
             <xs:maxLength value="25"/>
          </xs:restriction>
       </xs:simpleType>
    </xs:element>
  2. <xs:element name="MyIntegerInStringForm" minOccurs="0">
       <xs:simpleType>
          <xs:restriction base="xs:string">
             <xs:pattern value="[0-9]{7}"></xs:pattern>
          </xs:restriction>
       </xs:simpleType>
    </xs:element>
  3. <xs:element name="MyDateTimeInStringForm">
       <xs:simpleType>
          <xs:restriction base="xs:dateTime"/>
       </xs:simpleType>
    </xs:element>

No comments:

Post a Comment