net.sf.doolin.util.xml
Class SimpleErrorHandler

java.lang.Object
  extended by net.sf.doolin.util.xml.SimpleErrorHandler
All Implemented Interfaces:
ErrorHandler

public class SimpleErrorHandler
extends Object
implements ErrorHandler

This class implements a simple error handler that just stores the warnings and errors that occur during an XML parsing.

Author:
Damien Coraboeuf

Constructor Summary
SimpleErrorHandler()
           
 
Method Summary
 void error(SAXParseException exception)
           
 void fatalError(SAXParseException exception)
           
 List<SAXParseException> getErrors()
          Returns the list of errors
 List<SAXParseException> getWarnings()
          Returns the list of warnings
 boolean hasErrors()
          Returns if the handler contains some errors.
 boolean hasWarnings()
          Returns if the handler contains some warnings.
 void logWarnings(org.slf4j.Logger log)
          Logs all the warnings
 void throwAnyError()
          Throw the first error is any.
 void throwAnyWarningOrError()
          Throw the first error or warning is any.
 void warning(SAXParseException exception)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleErrorHandler

public SimpleErrorHandler()
Method Detail

error

public void error(SAXParseException exception)
           throws SAXException
Specified by:
error in interface ErrorHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException exception)
                throws SAXException
Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException

getErrors

public List<SAXParseException> getErrors()
Returns the list of errors

Returns:
List of errors

getWarnings

public List<SAXParseException> getWarnings()
Returns the list of warnings

Returns:
List of warnings

hasErrors

public boolean hasErrors()
Returns if the handler contains some errors.

Returns:
true if some errors have been generated.

hasWarnings

public boolean hasWarnings()
Returns if the handler contains some warnings.

Returns:
true if some warnings have been generated.

logWarnings

public void logWarnings(org.slf4j.Logger log)
Logs all the warnings

Parameters:
log - Logger to use

throwAnyError

public void throwAnyError()
                   throws SAXParseException
Throw the first error is any.

Throws:
SAXParseException - Thrown exception

throwAnyWarningOrError

public void throwAnyWarningOrError()
                            throws SAXParseException
Throw the first error or warning is any.

Throws:
SAXParseException - Thrown exception

warning

public void warning(SAXParseException exception)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Throws:
SAXException


Copyright © 2011. All Rights Reserved.