Mega Code Archive

 
Categories / XML Tutorial / XML Schema
 

Use quantifiers to limit the number of leading zeros-for instance

The following pattern limits the number of leading zeros to up to 2: <?xml version="1.0"?>   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">      <xs:simpleType name="myByte">        <xs:restriction base="xs:byte">          <xs:pattern value="0{0,2}1?5?"/>        </xs:restriction>      </xs:simpleType>  </xs:schema>