jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • castor
  • CASTOR-2845

Regular Expression not getting validated

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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?

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Manpreet added a comment - 04/Nov/09 11:45 PM

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

Show
Manpreet added a comment - 04/Nov/09 11:45 PM 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

People

  • Assignee:
    Unassigned
    Reporter:
    Manpreet
Vote (0)
Watch (0)

Dates

  • Created:
    03/Nov/09 10:44 PM
    Updated:
    30/Dec/09 4:21 AM
    Resolved:
    04/Nov/09 11:45 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.