Cannot validate against schema
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 2
- Joined: Sat Mar 06, 2010 10:53 pm
Cannot validate against schema
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?
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Cannot validate against schema
Hello,
Neither Xerces nor Saxon seem to accept the pattern.
You just have to escape the '-' character so it's no longer confused with a character range.instead of
Let me know if you need further help.
Regards,
Adrian
Neither Xerces nor Saxon seem to accept the pattern.
You just have to escape the '-' character so it's no longer confused with a character range.
Code: Select all
^\w+[\w\-\.]*
Code: Select all
^\w+[\w-\.]*
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Cannot validate against schema
PS:
I also see that '\@' isn't liked by Saxon and since the escaping seems redundant you can simply use '@'.
I also see that '\@' isn't liked by Saxon and since the escaping seems redundant you can simply use '@'.
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service