I am trying to validate a xml schema by giving restriction in xsd. The schema has 555-333-4834,444-233-3333 which could contain either one or several phone numbers.
This is my solution:
  <xs:element name="PhoneNumber" minOccurs="1" maxOccurs="unbounded">         <xs:simpleType>             <xs:restriction base="xs:string">                 <xs:maxLength value="14"></xs:maxLength>                 <xs:minLength value="10"></xs:minLength>                 <xs:pattern value="^[0-9]{3}(-[0-9]{3})(-[0-9]{4})?"></xs:pattern>             </xs:restriction>         </xs:simpleType>     </xs:element>      Aim is to check if first 3 are digits. I tried to test with this. It works fine for 1 number but not for list of numbers.
 
No comments:
Post a Comment