DLESE Tools
v1.6.0

org.dlese.dpc.xml
Class SimpleErrorHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.dlese.dpc.xml.SimpleErrorHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler

public class SimpleErrorHandler
extends DefaultHandler
implements LexicalHandler

A simple XML error handler that catches XML errors and warnings and saves them to StringBuffers so the errors can be extracted and displayed.

Author:
John Weatherley

Method Summary
 void comment(char[] ch, int start, int length)
          DESCRIPTION
 void endCDATA()
          DESCRIPTION
 void endDTD()
          DESCRIPTION
 void endEntity(String name)
          DESCRIPTION
 void error(SAXParseException exc)
          DESCRIPTION
 void fatalError(SAXParseException exc)
          DESCRIPTION
 boolean hasErrors()
          Determines whether the parser found any validation errors.
 boolean hasWarnings()
          Determines whether the parser found any validation warnings.
 void startCDATA()
          DESCRIPTION
 void startDTD(String name, String publicId, String systemId)
          DESCRIPTION
 void startEntity(String name)
          DESCRIPTION
 void warning(SAXParseException exc)
          DESCRIPTION
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

error

public void error(SAXParseException exc)
DESCRIPTION

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Parameters:
exc - DESCRIPTION

hasErrors

public boolean hasErrors()
Determines whether the parser found any validation errors.

Returns:
True if errors were found, else false.

hasWarnings

public boolean hasWarnings()
Determines whether the parser found any validation warnings.

Returns:
True if warnings were found, else false.

fatalError

public void fatalError(SAXParseException exc)
DESCRIPTION

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Parameters:
exc - DESCRIPTION

warning

public void warning(SAXParseException exc)
DESCRIPTION

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Parameters:
exc - DESCRIPTION

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
DESCRIPTION

Specified by:
startDTD in interface LexicalHandler
Parameters:
name - DESCRIPTION
publicId - DESCRIPTION
systemId - DESCRIPTION
Throws:
SAXException - DESCRIPTION

endDTD

public void endDTD()
            throws SAXException
DESCRIPTION

Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException - DESCRIPTION

startEntity

public void startEntity(String name)
                 throws SAXException
DESCRIPTION

Specified by:
startEntity in interface LexicalHandler
Parameters:
name - DESCRIPTION
Throws:
SAXException - DESCRIPTION

endEntity

public void endEntity(String name)
               throws SAXException
DESCRIPTION

Specified by:
endEntity in interface LexicalHandler
Parameters:
name - DESCRIPTION
Throws:
SAXException - DESCRIPTION

startCDATA

public void startCDATA()
                throws SAXException
DESCRIPTION

Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException - DESCRIPTION

endCDATA

public void endCDATA()
              throws SAXException
DESCRIPTION

Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException - DESCRIPTION

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
DESCRIPTION

Specified by:
comment in interface LexicalHandler
Parameters:
ch - DESCRIPTION
start - DESCRIPTION
length - DESCRIPTION
Throws:
SAXException - DESCRIPTION

DLESE Tools
v1.6.0