GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse.sax
Class SAXErrorListener

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.xml.sax.ext.DefaultHandler2
          extended by ca.gorman.xml.parse.sax.SAXErrorListener
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, EntityResolver2, LexicalHandler

public class SAXErrorListener
extends DefaultHandler2

Report warnings, recoverable errors, and fatal errors from SAXParser or XMLReader. Default behavior is to stop on the first fatal error.


Field Summary
static int ACCEPT_NONE
           
static int FATAL_ERROR
           
static int RECOVERABLE_ERROR
           
static int WARNING
           
 
Constructor Summary
SAXErrorListener(Writer writer)
           Construct on the Writer that sends output to destination.
 
Method Summary
 void error(SAXParseException exception)
           Receive an error notification.
 void fatalError(SAXParseException exception)
           Receive a fatal error notification.
 int getMaxCount()
           Get the number of warnings or errors that will be reported before the next one will stop the parse.
 int getMaxErrorLevel()
           Get the highest error level that will not immediately stop the parse.
 void setMaxCount(int i)
           Set the number of warnings and errors that will be reported before the next one will stop the parse.
 void setMaxErrorLevel(int i)
           Set the highest level of warning or error that will be accepted without immediately stopping the parse.
 void warning(SAXParseException exception)
           Receive a warning notification.
 
Methods inherited from class org.xml.sax.ext.DefaultHandler2
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_NONE

public static final int ACCEPT_NONE
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

RECOVERABLE_ERROR

public static final int RECOVERABLE_ERROR
See Also:
Constant Field Values

FATAL_ERROR

public static final int FATAL_ERROR
See Also:
Constant Field Values
Constructor Detail

SAXErrorListener

public SAXErrorListener(Writer writer)

Construct on the Writer that sends output to destination.

Method Detail

warning

public void warning(SAXParseException exception)
             throws SAXException

Receive a warning notification.

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Throws:
SAXException

error

public void error(SAXParseException exception)
           throws SAXException

Receive an error notification.

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException exception)
                throws SAXException

Receive a fatal error notification.

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Throws:
SAXException

getMaxErrorLevel

public int getMaxErrorLevel()

Get the highest error level that will not immediately stop the parse.

See Also:
setMaxErrorLevel(int)

setMaxErrorLevel

public void setMaxErrorLevel(int i)

Set the highest level of warning or error that will be accepted without immediately stopping the parse. The levels, in increasing order of severity are:

The initial (default) value is SAXErrorListener.RECOVERABLE_ERROR.

Throws:
IllegalArgumentException - if the parameter is not one of the values above.

getMaxCount

public int getMaxCount()

Get the number of warnings or errors that will be reported before the next one will stop the parse.


setMaxCount

public void setMaxCount(int i)

Set the number of warnings and errors that will be reported before the next one will stop the parse. The initial (default) value is Integer.MAX_VALUE.

Parameters:
i - an integer zero or greater.
Throws:
IllegalArgumentException - if the parameter is a negative integer

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License