users@jaxb.java.net

Re: validation event messages & element names

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 08 Jul 2003 15:03:17 -0700

damian fauth <dfauth_at_users.sourceforge.net> wrote:
> One of our requirements is to report back validation errors,
> encapsulated in an XML message, back to the requesting client. The
> problem is that the format of these messages is very specific - in the
> case of validation errors on elements enclosing text, we are required to
> classify the validation error according to type (too long, out of range,
> not an allowed value, non-numeric type etc.) and report it back
> associated with the offending element name.

If you need more error information from the XML validation itself, I
suggest you to take a look at the JARV API (search Google for "JARV")

This API allows you to pin-point the error to individual element level,
and you'll get access to everything including element names, attributes,
its location, etc.

It can work as a filter, so you could then form the following pipeline:

    XML parser --> JARV validator --> JAXB unmarshaller

In this way you can do the unmarshalling and validation at the same time.


I'm not sure if it satisfies all your needs, but I believe it's better
than what JAXB can offer.

Also, my XSDLib
(http://msv.dev.java.net/servlets/ProjectDocumentList?folderID=101)
offers more fine-grained control over the datatype validation, so this
might be of some use to you, too.


We take the issue of reporting better error messages seriosly, so let us
know what you think on this issue.


regards,
--
Kohsuke Kawaguchi                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com