xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dutta Satadip <s-du...@sbcglobal.net>
Subject Retrieving Validation Errors Programatically
Date Wed, 03 Mar 2004 05:19:35 GMT
Hello,
 
A bug was filed for extracting errors programatically.( http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27342)
Here is the attached patch for retrieving xml validation errors programatically.
 
the attached snippet can be used to extract the errors programatically
 

XmlOptions validateOptions = new XmlOptions();

ArrayList errorList = new ArrayList();

 validateOptions. setValidationErrorListener (errorList);

 

// Validate the XML.

boolean isValid = newEmp.validate(validateOptions);

     * 

     * // If the XML isn't valid, loop through the listener's contents,

     * // printing contained messages.

     * if (!isValid)

     * {

          for (int i = 0; i < errorList.size(); i++)

         {

             XmlValidationError error = (XmlValidationError)errorList.get(i);

             //extract details as necessary

 

         }

 
Hope this is useful
With Regards
Dutta:)


 



> ATTACHMENT part 2 application/x-zip-compressed name=changes.zip



Mime
View raw message