users@jaxb.java.net

Re: On-demand-validation problem

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 06 Jan 2005 09:19:28 -0800

ValidationEventLocator objects are supposed to be created by the JAXB
RI. All you need to do is to cast it to ValidationEventLocatorEx to get
the location information.

But sounds like the ValidationEventLocator object you are getting
doesn't implement this interface. If so, could you show me the stack
trace that leads to your ValidationEventHandler callback? In that way I
can pinpoint where the problematic ValidationEventLocator object is
being created, and thus I'll be able to fix the bug.


domakmail-informatique_at_yahoo.fr wrote:
> Hi,
>
> Thanks for your response. I was looking a lot but didn't find the way to replace
> the default ValidationEventLocator
> (javax.xml.bind.helpers.ValidationEventLocatorImpl) by
> com.sun.xml.bind.ValidationEventLocatorEx.
> Could you help me?
>
> Thanks
>
> Christophe
>
>
> */Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>/* wrote:
>
>
> ValidationEvent object has a ValidationEventLocator, and for the JAXB RI
> this Locator object should implement
> com.sun.xml.bind.ValidationEventLocatorEx, which has the getFieldName
> method.
>
> I hope that will solve your problem.
>
> domakmail-informatique_at_yahoo.fr wrote:
> > Hi and happy new year,
> >
> > I have a xml file with a sequence of complexe types. I want to check
> simply some
> > value elements and log an error with a record id (one of the element of my
> > complex type). I can't do validation during the unmarshalling process
> cause I
> > don't have the id yet. So I'm trying to validate-on-demand each java objects
> > after the unmarshalling process. But, when I catch the
> ValidationException, I
> > don't see the field that trigger the exception.
> >
> > Ex: I want to check that some values don't exceed ! 10 chars.
> >
> >
> >
> >
> >
> >
> >
> > When I invoke the Validator.validate() method, I got an exception like :
> > class: class javax.xml.bind.ValidationException
> > cause: null
> > errorCode: null
> > linkedException: com.sun.xml.bind.serializer.AbortSerializationException:
> the
> > length of the value is 12, but the required maximum is 10.
> > localizedMessage: null
> > message: null
> > stackTrace: [Ljava.lang.StackTraceElement;@1c54796
> >
> > But I don't have the name of the field (and in the debugger, I can see it
> in the
> > context
> > .impl.runtime.XMLSerializer passed to the MSVValidator).
> >
> > How can I retrieve the name of the field. Do I have to create my own
> validator
> ! > and don't use the schema constraints?
> >
> > Thanks a lot,
> >
> > Christophe
> >
> >
> --------------------------------------------------------------------------------
> > Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos
> mails !
> > Créez votre Yahoo! Mail
> >
> >
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
> --------------------------------------------------------------------------------
> Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
> Créez votre Yahoo! Mail
> <http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*http://fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions.yahoo.com/mail/creer28.html>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net