how to define min and max number of characters for a complexType?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 175518
    New Member
    • Nov 2012
    • 2

    how to define min and max number of characters for a complexType?

    i have my complexType element .have no idea how to set min and max number of characters allowed to use for element "author".

    here is my complexType element from schema
    Code:
    <xsd:element name="author">
     <xsd:complexType>
    	         <xsd:simpleContent>
                  <xsd:extension base="xsd:string">
                   <xsd:attribute type="xsd:string" name="gender" use="required"/>
    			  </xsd:extension>
                 </xsd:simpleContent>
                </xsd:complexType>
               </xsd:element>
    for simpleType i already made this
    Code:
    <xsd:element name="original_title">
    		    <xsd:simpleType>
                 <xsd:restriction base="xsd:string">
                  <xsd:minLength value="3"/>
                  <xsd:maxLength value="22"/>
                 </xsd:restriction>
                </xsd:simpleType>
               </xsd:element>
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    (source: http://www.w3schools.com/schema/schema_facets.asp)
    This example defines another element called "password" with a restriction. The value must be minimum five characters and maximum eight characters:


    Code:
     <xs:element name="password">
      <xs:simpleType>
         <xs:restriction base="xs:string">
           <xs:minLength value="5"/>
           <xs:maxLength value="8"/>
         </xs:restriction>
       </xs:simpleType>
    </xs:element>

    Comment

    Working...