0

I want to validate AGE filed in my schema but i have given some restriction on it but when i give the string value in AGE filed which is not throwing the error like "Invalid data for AGE". May i know how to solve this issue? Please find my sample code below.

XML File

<?xml version="1.0"?>
<Employee>
    <AGE>thf</AGE>
</Employee>

XSD File

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Employee">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="AGE">
        <xs:simpleType>
            <xs:restriction base="xs:integer">
                <xs:minInclusive value="1"/>
                <xs:maxInclusive value="65"/>
            </xs:restriction>
        </xs:simpleType>
     </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>
4

0 回答 0