While iterating through your error objects, try casting the to XmlError and getting more detailed information from there.

Ie.

                                       XmlError err = (XmlError) objects.next();
                                       System.out.println(err.getLine() err.getColum());

Don’t quote me on the method names but something similar exists for all kinds of error related information.

-Jacobd


From: Peter Luttrell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 31, 2005 10:25 AM
To: [email protected]
Subject: More Detailed Validation Errors

 


I would like to find out how to get more detailed validation errors.

I am generating a very large XML document. After generation is complete, I validate it and handle the messages. The problem is I'm getting message without any reference to the attribute or element name that it was caused by. For example:

        error: decimal: Invalid decimal value: expected at least one digit

Here's the sample code:

        List validationErrors = new ArrayList();
                 XmlOptions validationOptions = new XmlOptions();
                 validationOptions.setErrorListener( validationErrors );

        if( !document.validate( validationOptions ) ) {
                for( Iterator objects = validationErrors.iterator(); objects.hasNext(); ) {
                                       Object object = objects.next();
                                       System.out.println( object );
                            }
        }

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to