|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XML Schema and ZIP code
> -----Original Message----- > From: Cirip Tomas [mailto:tomas.cirip@t...] > > Hi, > > does anybody have US ZIP code definition in XML Schema? Thank you > > Tomas Here's one quick attempt (using regex). Mike ===== C:\XML\XMLSchema\Examples>cat zip.xml <?xml version="1.0"?> <zip>97068-9294</zip> C:\XML\XMLSchema\Examples>cat zip.xsd <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="ZipCode"> <xs:choice> <xs:element name="zip" type="ZipCode5"/> <xs:element name="zip" type="ZipCode9"/> </xs:choice> </xs:complexType> <xs:simpleType name="ZipCode5"> <xs:restriction base="xs:string"> <xs:pattern value="\d{5}"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="ZipCode9"> <xs:restriction base="xs:string"> <xs:pattern value="\d{5}-\d{4}"/> </xs:restriction> </xs:simpleType> </xs:schema> C:\XML\XMLSchema\Examples>xsv zip.xml zip.xsd <?xml version='1.0'?> <xsv xmlns='http://www.w3.org/2000/05/xsv' docElt="{None}zip" instanceAssessed="true" instanceErrors="0" schemaDocs="zip.xsd" schemaErrors="0" target="file:/C:/XML/XMLSchema/Examples/zip.xml" validation="lax" version="XSV 2.1-2 of 2002/11/25 15:00:34"> <schemaDocAttempt URI="file:/C:/XML/XMLSchema/Examples/zip.xsd" outcome="success" source="command line"/> </xsv>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








