Cannot validate against schema
Posted: Sat Mar 06, 2010 11:01 pm
I have an XML file with dummy data for a mock order and a XSD that I generated through Oxygen along with some data added by me. Of course the data added by me is the problem at the moment.
Oxygen is saying that the data in my XML file is invalid when faced against the regex patterns I have in my schema.
Here's the data from my XML file that is showing up as invalid (specifically: the street, zipcode, phone, accountNumber, and cvv):
Here are the date types I wrote in the XSD:
Also, Oxygen says my email regex is invalid because "'-' is an invalid character range," which causes the XSD to be invalid as well. I tested all of these regex's and they seem to properly work outside of Oxygen, but I can't get data to validate against them in Oxygen.
Any ideas?
Oxygen is saying that the data in my XML file is invalid when faced against the regex patterns I have in my schema.
Here's the data from my XML file that is showing up as invalid (specifically: the street, zipcode, phone, accountNumber, and cvv):
Code: Select all
<address>
<street>123 My House Rd.</street>
<state>PA</state>
<zipcode>12345</zipcode>
</address>
<phone>610-123-4567</phone>
<paymentInfo>
<accountName>
<first>Billy</first>
<middleInitial>R</middleInitial>
<last>Bob</last>
</accountName>
<accountNumber>1111999900001111</accountNumber>
<expirationDate>2014-04-12</expirationDate>
<cvv>645</cvv>
</paymentInfo>
Code: Select all
<xs:simpleType name="singleChar">
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="idnum">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="999999"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="alphanum">
<xs:restriction base="xs:string">
<xs:pattern value="^[a-zA-Z0-9\s.\-]+$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="cvv">
<xs:restriction base="xs:integer">
<xs:pattern value="^([0-9]{3,4})$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="cc">
<xs:restriction base="xs:integer">
<xs:pattern value="^(\d{4}-){3}\d{4}$|^(\d{4} ){3}\d{4}$|^\d{16}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="date">
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="email">
<xs:restriction base="xs:string">
<xs:pattern value="^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="zipcode">
<xs:restriction base="xs:integer">
<xs:pattern value="^[0-9]{5}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="phone">
<xs:restriction base="xs:string">
<xs:pattern value="^[2-9]\d{2}-\d{3}-\d{4}$"/>
</xs:restriction>
</xs:simpleType>
Any ideas?