users@jaxb.java.net

Re: Location of validation Errors

From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
Date: Tue, 19 Aug 2003 16:58:01 -0400

Paul Campbell wrote:

> Prior to JavaOne, there was an indication that the next version of jaxb
> would have the ValidationHandler updated to provide location information,
> because it was understood that it didn't make sense for everyone who needed
> to know which line number was in error to write his own handler.
>

There hasn't been a next version since JavaOne - our last release was
immediately before JavaOne and it did not contain the enhancements you
are referring to. I need to consult with Kohsuke when he returns, but
I believe he added some additional location info to the ValidationEvent
objects. This code would be available in our next release, which hasn't
been announced yet.

More comments below...

> I downloaded/installed the most recent version of JWSDP from javasoft.com
>
> I just ran an intentionaly flawed xml file and got this result without
> location information:
>
> [java] INFO: setValidating(true)
> [java] DefaultValidationEventHandler: [ERROR]: tag name
> "xile_owner_email"
> is not allowed. Possible tag names are:
> <file_owner_email>
> [java] Location:
> [java] com.sun.msv.verifier.ValidityViolation: tag name
> "xile_owner_email"
> is not allowed. Possible tag names are:
> <file_owner_email>
> [java] at com.sun.msv.verifier.Verifier.onError(Verifier.java:331)
>

I assume you're validating during an unmarshal() call in this case - what
was your exact call to unmarshal()? If you happen to be unmarshalling
from a file via a FileInputStream, then you won't get line number info,
but if you simply unmarshal from the File object, you will (although the
details of why this is the case escape me right now).

Thanks,

--Ryan



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net