You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jacob Danner <ja...@bea.com> on 2005/08/31 18:48:47 UTC

RE: More Detailed Validation Errors

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:Peter_Luttrell@mgic.com] 
Sent: Wednesday, August 31, 2005 10:25 AM
To: user@xmlbeans.apache.org
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: user-unsubscribe@xmlbeans.apache.org For additional
commands, e-mail: user-help@xmlbeans.apache.org