none
Datatable and minLength restriction RRS feed

  • Question

  • Hi, i want to define an element which cannot be empty or with a minimum length , i was trying with datatable to insert the minLegth restriction

    but it rejects it and accepts only the maxLength restriction, are there any way to resolve this?

    I was thinking of regular expressions with facets but i want to see if i can resolve this problem in a clear way.

    In my applications now i only read the schema and then write it to a file to see how does datatable sees the schema.

    The xsd i load in the datatable is this:

     

    <?xml version="1.0" standalone="yes"?>
    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="tabella" msdata:UseCurrentLocale="true">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="tabella">
              <xs:complexType>
                <xs:sequence>
               
     
              
                    <xs:element name="password" >
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:minLength value="1"></xs:minLength>   
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>

                   
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>

     

    and when i write the schema readed by datatble i get this:(here there is only dhe element part, the rest is equal to before)

                  <xs:element name="password">
                    <xs:simpleType>
                      <xs:restriction base="xs:string" />
                    </xs:simpleType>
                  </xs:element>

    Thanks.

    • Moved by Xianfeng Zhang Monday, October 11, 2010 6:35 AM Actually it's a question about behavior of DataTable (From:XML and the .NET Framework)
    Thursday, September 30, 2010 8:58 AM

All replies

  • Hi, i noticed that datatable doesn't accept even facets, i tryied this element but it isn't considered

     

                    <xs:element name="password" >
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:pattern value="[a-z]+"/>                        
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>

     

    i have in output this

                  <xs:element name="password">
                    <xs:simpleType>
                      <xs:restriction base="xs:string" />
                    </xs:simpleType>
                  </xs:element>

     

    Thursday, September 30, 2010 9:36 AM