I thought there was an API method on
XMlError for getting location information when its relevant. Try something like
getLine and/or getColumn()
XmlError
err = (XmlError)objects.next();
err.getLine();
-Jacobd
From: Peter Luttrell
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 06, 2005
2:45 PM
To: [email protected]
Subject: Better Validation Error
Messages
Does anyone know how to get better validation error
messages?
For
example I just got this "cvc-minLength-valid.1.1: string length (string)
is less than minLength facet (0) for 4" How do I know what element is
causing this? I have quite a large XML Doc.
I
tried casting the actual validationErrors coming back to XmlValidationErrors
(which is their type), but unfortunatly there isn't any relevant data in it's
fields.
Here's
the code:
XmlOptions validationOptions = new XmlOptions();
validationOptions.setErrorListener(
validationErrors );
if( !document.validate( validationOptions ) ) {
for( Iterator objects =
validationErrors.iterator(); objects.hasNext(); ) {
Object object = objects.next();
if( object instanceof
XmlValidationError ) {
-peter
--------------------------------------------------------------------- To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]
|