Hi Daniel,

It could be great if you could isolate the problems sending a small
schema and a small piece of code that demonstrates the problem...even
better if you write a CTF test case, it will be easier for us to debug
it.
>From the information below I can't really help you: min/maxLength are
working in my test cases as well as enumeration.

Arnaud

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2003 10:41 AM
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] castor - validation problems :((
> 
> 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.AlwaysTrueRegExpEval
uato
> 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

Reply via email to