GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse
Class AbstractMessageListener<T extends Parser>

java.lang.Object
  extended by ca.gorman.xml.parse.AbstractMessageListener<T>
All Implemented Interfaces:
MessageListener<T>

public abstract class AbstractMessageListener<T extends Parser>
extends Object
implements MessageListener<T>

Listener that reports warnings, recoverable errors, and fatal errors to a Writer or to System.err.


Field Summary
static int ACCEPT_NONE
           
static int FATAL_ERROR
           
static int RECOVERABLE_ERROR
           
static int WARNING
           
 
Constructor Summary
protected AbstractMessageListener()
           Construct on default destination (System.err).
protected AbstractMessageListener(Writer writer)
           Construct on a Writer as destination for error messages.
 
Method Summary
 void error(T parser, String description, Location location, Exception exception)
          

Receive notification of a recoverable error..

 void fatalError(T parser, String description, Location location, Exception exception)
          

Receive notification of a non-recoverable error..

 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.
static
<T extends Parser>
AbstractMessageListener<T>
newInstance()
           
static
<T extends Parser>
AbstractMessageListener<T>
newInstance(Writer writer)
           
 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(T parser, String description, Location location, Exception exception)
          

Receive notification of a warning..

 
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

AbstractMessageListener

protected AbstractMessageListener(Writer writer)

Construct on a Writer as destination for error messages.


AbstractMessageListener

protected AbstractMessageListener()

Construct on default destination (System.err).

Method Detail

newInstance

public static <T extends Parser> AbstractMessageListener<T> newInstance()

newInstance

public static <T extends Parser> AbstractMessageListener<T> newInstance(Writer writer)

warning

public void warning(T parser,
                    String description,
                    Location location,
                    Exception exception)
             throws ListenerException,
                    IOException

Receive notification of a warning..

Reports the warning to System.err.

Specified by:
warning in interface MessageListener<T extends Parser>
Parameters:
parser - The Parser that invoked this method
description - A summary of the warning information (may be an empty String).
location - Information about the location in the input
exception - Additional information from the underlying parser. The information will depend on the Parser implementation. The parameter may be null, and the underlying parser may not have actually thrown an exception.
Throws:
ListenerException
IOException

error

public void error(T parser,
                  String description,
                  Location location,
                  Exception exception)
           throws ListenerException,
                  IOException

Receive notification of a recoverable error..

Reports the error to System.err.

Specified by:
error in interface MessageListener<T extends Parser>
Parameters:
parser - The Parser that invoked this method
description - A summary of the warning information (may be an empty String).
location - Information about the location in the input
exception - Additional information from the underlying parser. The information will depend on the Parser implementation. The parameter may be null, and the underlying parser may not have actually thrown an exception.
Throws:
ListenerException
IOException

fatalError

public void fatalError(T parser,
                       String description,
                       Location location,
                       Exception exception)
                throws ListenerException,
                       IOException

Receive notification of a non-recoverable error..

Reports the fatal error to System.err and throws ListenerException with exception as the cause.

Specified by:
fatalError in interface MessageListener<T extends Parser>
Parameters:
parser - The Parser that invoked this method
description - A summary of the warning information (may be an empty String).
location - Information about the location in the input
exception - Additional information from the underlying parser. The information will depend on the Parser implementation. The parameter may be null, and the underlying parser may not have actually thrown an exception.
Throws:
ListenerException
IOException

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 AbstractMessageListener.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