ErrorHandler


ErrorHandler org.xml.sax

Java 1.4

Before parsing an XML document, an application should provide an implementation of this interface to the XMLReader by calling the setErrorHandler( ) method of the XMLReader . If the reader needs to issue a warning or report an error or fatal error, it will call the appropriate method of the ErrorHandler object you supplied. The error( ) method is used to report recoverable errors, such as document validity problems. The parser continues parsing after calling error( ) . The fatalError( ) method is used to report nonrecoverable errors, such as well- formedness problems. The parser may not continue parsing after calling fatalError( ) . An ErrorHandler object may respond to warnings, errors, and fatal errors however it likes, and may throw exceptions from these methods .

Instead of implementing this interface directly, you may also subclass the helper class org.xml.sax.helpers.DefaultHandler and override the error reporting methods it provides. The warning( ) and error( ) methods of a DefaultHandler do nothing, and the fatalError( ) method throws the SAXParseException object that was passed to it.

 public interface  ErrorHandler  {  // Public Instance Methods  void  error  (SAXParseException  exception  ) throws SAXException;        void  fatalError  (SAXParseException  exception  ) throws SAXException;        void  warning  (SAXParseException  exception  ) throws SAXException;   } 

Implementations

HandlerBase , org.xml.sax.helpers.DefaultHandler , org.xml.sax.helpers.XMLFilterImpl

Passed To

javax.xml.parsers.DocumentBuilder.setErrorHandler( ) , javax.xml.validation.SchemaFactory.setErrorHandler( ) , javax.xml.validation.Validator.setErrorHandler( ) , javax.xml.validation.ValidatorHandler.setErrorHandler( ) , Parser.setErrorHandler( ) , XMLReader.setErrorHandler( ) , org.xml.sax.helpers.ParserAdapter.setErrorHandler( ) , org.xml.sax.helpers.XMLFilterImpl.setErrorHandler( ) , org.xml.sax.helpers.XMLReaderAdapter.setErrorHandler( )

Returned By

javax.xml.validation.SchemaFactory.getErrorHandler( ) , javax.xml.validation.Validator.getErrorHandler( ) , javax.xml.validation.ValidatorHandler.getErrorHandler( ) , XMLReader.getErrorHandler( ) , org.xml.sax.helpers.ParserAdapter.getErrorHandler( ) , org.xml.sax.helpers.XMLFilterImpl.getErrorHandler( )



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net