dk.brics.xmlgraph.validator
Class SimpleErrorHandler

java.lang.Object
  extended by dk.brics.xmlgraph.validator.SimpleErrorHandler
All Implemented Interfaces:
ValidationErrorHandler

public class SimpleErrorHandler
extends Object
implements ValidationErrorHandler

Simple validation error handler.


Constructor Summary
SimpleErrorHandler(PrintStream out)
          Constructs a new error handler.
SimpleErrorHandler(PrintStream out, Origin program_source)
          Constructs a new error handler.
SimpleErrorHandler(PrintWriter out)
          Constructs a new error handler.
SimpleErrorHandler(PrintWriter out, Origin program_source)
          Constructs a new error handler.
 
Method Summary
 boolean error(ElementNode n, Origin origin, String msg, String example, Origin schema)
          Called when a validation error is detected.
 int getErrors()
          Returns number of errors that have been reported.
 void setOutput(PrintWriter out)
          Sets output print writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleErrorHandler

public SimpleErrorHandler(PrintStream out)
Constructs a new error handler.

Parameters:
out - print stream for error messages (using default character encoding)

SimpleErrorHandler

public SimpleErrorHandler(PrintStream out,
                          Origin program_source)
Constructs a new error handler.

Parameters:
out - print stream for error messages (using default character encoding)

SimpleErrorHandler

public SimpleErrorHandler(PrintWriter out)
Constructs a new error handler.

Parameters:
out - print writer for error messages

SimpleErrorHandler

public SimpleErrorHandler(PrintWriter out,
                          Origin program_source)
Constructs a new error handler.

Parameters:
out - print writer for error messages
program_source - program source location, null if not applicable
Method Detail

error

public boolean error(ElementNode n,
                     Origin origin,
                     String msg,
                     String example,
                     Origin schema)
Description copied from interface: ValidationErrorHandler
Called when a validation error is detected.

Specified by:
error in interface ValidationErrorHandler
Parameters:
n - current node, null if processing root contents
origin - origin of current node, only relevant if processing root contents
msg - brief description of the error
example - example of invalida data, null if not applicable
schema - origin of the schema rule being violated
Returns:
true iff validation should continue

getErrors

public int getErrors()
Returns number of errors that have been reported.

Returns:
number of errors

setOutput

public void setOutput(PrintWriter out)
Sets output print writer.



Copyright © 2005-2010 Anders Møller.