Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 1051
نمايش فراداده

ErrorListenerjavax.xml.transform

Java 1.4

This interface defines methods that transformer and TRansformerFactory use for reporting warnings, errors, and fatal errors to an application. To use an ErrorListener, an application must implement this interface and pass an implementing object to the setErrorListener( ) method of transformer or transformerFactory. The argument to each method of this interface is a TRansformerException object, and the implementation of these methods can throw that exception if it chooses, or it can simply log the warning or error in some way and return. A transformer or transformerFactory is not required to continue processing after reporting a nonrecoverable error with an invocation of the fatalError( ) method.

If you are familiar with the SAX API for parsing XML documents, you'll recognize that this interface is very similar to org.xml.sax.ErrorHandler.

public interface

ErrorListener { // Public Instance Methods void

error (TransformerException

exception ) throws TransformerException; void

fatalError (TransformerException

exception ) throws TransformerException; void

warning (TransformerException

exception ) throws TransformerException; }

Passed To

transformer.setErrorListener( ), transformerFactory.setErrorListener( )

Returned By

transformer.getErrorListener( ), transformerFactory.getErrorListener( )