Last update: 2011-06-23

org.proteios.io
Class XMLValidatorLazyErrorHandler

java.lang.Object
  extended by org.proteios.io.XMLValidatorLazyErrorHandler
All Implemented Interfaces:
ErrorHandler

public class XMLValidatorLazyErrorHandler
extends Object
implements ErrorHandler

This class handles errors when validating an XML file against an XSD (XML Schema Definition) file. This error handler does not print any error messages, but only propagates all non-warning exceptions further (that's why it is called "lazy"). Intended to be used in connection with methods that want to handle validation errors themselves, e.g. where one wants a simple true/false response on whether an XML file is valid. Based on MyErrorHandler.java by Neeraj Bajaj, Sun Microsystems, in example code described here.

Version:
2.0
Author:
Olle
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Constructor Summary
XMLValidatorLazyErrorHandler()
          Default constructor.
 
Method Summary
 void error(SAXParseException sAXParseException)
          Handles validation non-fatal errors.
 void fatalError(SAXParseException sAXParseException)
          Handles validation fatal errors.
 void warning(SAXParseException sAXParseException)
          Handles validation warnings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLValidatorLazyErrorHandler

public XMLValidatorLazyErrorHandler()
Default constructor.

Method Detail

error

public void error(SAXParseException sAXParseException)
           throws SAXException
Handles validation non-fatal errors.

Specified by:
error in interface ErrorHandler
Parameters:
sAXParseException - An org.xml.sax.SAXParseException exception.
Throws:
SAXException

fatalError

public void fatalError(SAXParseException sAXParseException)
                throws SAXException
Handles validation fatal errors.

Specified by:
fatalError in interface ErrorHandler
Parameters:
sAXParseException - An org.xml.sax.SAXParseException exception.
Throws:
SAXException

warning

public void warning(SAXParseException sAXParseException)
Handles validation warnings.

Specified by:
warning in interface ErrorHandler
Parameters:
sAXParseException - An org.xml.sax.SAXParseException exception.

Last update: 2011-06-23