# Uncomment the following to basically supress evaluation of Regular expressions org.exolab.castor.regexp=org.exolab.castor.xml.util.AlwaysTrueRegExpEvaluato r
By uncommenting that, it seems like you are instructing Castor to use a RegExp Evaluator that always returns true.... hence the behaviour you are seeing.
I would have a look at the source for the org.exolab.xml.util.AlwaysTrueRegExpEvaluator to confirm this.
Hope this helps.
Patrick
[EMAIL PROTECTED] wrote:
I've got a big problem with castor validation issues.
I've generated java code using SourceGenerator (with full options, descriptors etc.) from my xsd. I've put in my xsd some basic validation rules. (for example concerning length o social security numbers -> maxOccurs minOccurs and some validation rules with regular expressions describes maxLength, format etc...).
So when i'm marshalling or unmarshalling my objects, validaton rules like minOccurs and maxOccurs works fine but validation rules from xsd concerning regular expressions (like maxLength, format) and validation rules like enumerations doesn't work.
When i'm unmarshalling xml with non-regular-expression valid fields (on example bad length or format) unmarshaller claims that everything is OK and even when i'm calling isValid() method on that no valid objects castor method always returns true.
What's going on?
i think my castor.properties is OK. I've enabled validation framework like this: ---------- org.exolab.castor.marshalling.validation=true
# An implementation which uses the Jakarta RegExp library org.exolab.castor.regexp=org.exolab.castor.util.JakartaRegExpEvaluator
# Uncomment the following to basically supress evaluation of Regular expressions org.exolab.castor.regexp=org.exolab.castor.xml.util.AlwaysTrueRegExpEvaluato r ----------
and my unmarshalling or validation code looks like below:
----------
//if regular expressions and enumerations in my xml file are not compatibile to xsd rules //unmarshaller claims that everything is ok. If min max Occurs rules are bad in xml file //everything is ok -> xsd rules are fired.
Unmarshaller a = new Unmarshaller(Order.class); order = (Order)a.unmarshal(new FileReader("castor_test.xml"));
//when i'm calling isValid() method on non valid object build with set method //isValid() returns always true no matter if object data are valid or non vaild.
order.setSocialSecutityNumber("bla bla bla") return order.isValid();
i've checked classDescriptors and everything seems to be ok.
//example from Descriptor class
//-- validation code for: _example_number_to_validate_regular_expressions fieldValidator = new FieldValidator(); { //-- local scope NameValidator nv = new NameValidator(NameValidator.CDATA); nv.setPattern("\\d{11}"); fieldValidator.setValidator(nv); } desc.setValidator(fieldValidator);
please help if u have any suggestions
danny
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev