I am using XmlReader with XSD attached for validation.
Since my XML document is read and validated, I want to define in my C # code the value "maxLength" specified in the XSD for a specific element. For example, my XSD fragment is very simply defined as:
<xsd:element name="testing" minOccurs="0"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="10"/> </xsd:restriction> </xsd:simpleType> </xsd:element>
I can easily get the minOccurs value using:
myReader.SchemaInfo.SchemaElement.MinOccurs;
But how do I get the value of maxLength (value 10 in my example above) ???
I thought that " myReader.SchemaInfo.SchemaElement.Constraints " could give me this information, but this collection always has a "graph" of zero.
Thanks,
Pat.
c # maxlength xsd
Pat mcbennett
source share