Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.3
-
Fix Version/s: 1.3
-
Component/s: XML schema support
-
Labels:None
-
Environment:Windows XP, jdk1.5, Ant 1.7.1, Castor 1.3
Description
Hi,
I generated Java code for given schema files using Castor 1.3.
Now I'm trying to unmarshall XML file but its failing giving error:
Caused by: ValidationException: 000740-902616553102056does not match the required regular expression: "[0-9]{6}[\-]{1}[A-Z0-9]{1,15}"
at org.exolab.castor.xml.validators.PatternValidator.validate(PatternValidator.java:230)
at org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:302)
at org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:340)
at org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:333)
at org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:277)
In the castorbuilder.properties I've given:
org.exolab.castor.regexp=org.exolab.castor.util.JakartaRegExpEvaluator
and also put 'jakarta-regexp-1.5.jar' in the classpath.
The XML element is:
<rm:SMASRefID>000740-902616553102056</rm:SMASRefID>
The Schema check for this element:
<SMA_RM>
..
<xsd:element ref = "SMASRefID" minOccurs = "0" maxOccurs = "1"/>
<xsd:element name = "SMASRefID" type = "SMASRefIDDataType"/>
<xsd:simpleType name="SMASRefIDDataType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{6}[\-]{1}[A-Z0-9]{15}"/>
</xsd:restriction>
</xsd:simpleType>
</SMA_RM>
I'm tryint unmarshall this using:
File f = new File("C:\\data1\\Sample_Files_for_UBS
7.MAS_TT.xml");
FileReader r = new FileReader(f);
Unmarshaller.unmarshal(SMA_RM.class, r);
Need help. Have I missed something?
Sorry, I got confused between castor.properties and castorbuilder.properties.
I moved the property
org.exolab.castor.regexp=org.exolab.castor.util.JakartaRegExpEvaluator
to castor.properties and put it in classpath..works fine now.
Thanks