users@jaxb.java.net

Re: ValidationEventHandler returns strange Locator.Object

From: <MRist_at_lstelcom.com>
Date: Tue, 18 May 2004 12:09:56 +0200

Hi Kohsuke,

I use the JAXB classes as internal data model of my application. Because of
that fact it is possible to programatically handle 'constraints' errors
that are defined in the xsd.

You are right, if locator returns the leaf Object its not clear in which
parent this leaf lives. But returnling always the parent of a leaf is only
a little bit more exact. Maybe the parrent appears several times in the
schema...

From endusers point of view, response has more impact if user can search
all leafs with name xxx where constraint may be validated, than look on all
leafs of the parent (user doesn't know fullfiled constraints). Especially
because of the reported error tells the user about the concrete violation
(in may case String length).

I'm not a xml expert, but returning a XPATH expression or returning (only)
the leaf whould be a consistent way for locating validation errors.

Is it possible to (over)write/hook Locator functionality in JAXB to solve
my problem (examples)?

Regards,
Michael







                                                                                                                                                   
                      Kohsuke Kawaguchi
                      <Kohsuke.Kawaguch To: users_at_jaxb.dev.java.net
                      i_at_Sun.COM> cc:
                                               Subject: Re: ValidationEventHandler returns strange Locator.Object
                      17.05.2004 21:28
                      Please respond to
                      users
                                                                                                                                                   
                                                                                                                                                   





I think what you are seeing is what we expect you see.

I guess a rationale is that if you get a leaf object (like String), then
you have no means of tracking the parent. So we felt that just giving
you the leaf node that violated the constraints wouldn't be suffice.

But at the same time, we don't think what we provide today is
sufficient; we just don't know what should be done.

Looks like you are trying to programatically handle errors, and I'm
curious how you are using it. Could you elaborate on that? Learning
about how it used might help us to come up with something.

regards,
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net