/**
   * Allow an application to register an error event handler.
   *
   * <p>If the application does not register an error handler, all error events reported by the SAX
   * parser will be silently ignored; however, normal processing may not continue. It is highly
   * recommended that all SAX applications implement an error handler to avoid unexpected bugs.
   *
   * <p>Applications may register a new or different handler in the middle of a parse, and the SAX
   * parser must begin using the new handler immediately.
   *
   * @param errorHandler The error handler.
   * @exception java.lang.NullPointerException If the handler argument is null.
   * @see #getErrorHandler
   */
  public void setErrorHandler(ErrorHandler errorHandler) {

    try {
      XMLErrorHandler xeh = (XMLErrorHandler) fConfiguration.getProperty(ERROR_HANDLER);
      if (xeh instanceof ErrorHandlerWrapper) {
        ErrorHandlerWrapper ehw = (ErrorHandlerWrapper) xeh;
        ehw.setErrorHandler(errorHandler);
      } else {
        fConfiguration.setProperty(ERROR_HANDLER, new ErrorHandlerWrapper(errorHandler));
      }
    } catch (XMLConfigurationException e) {
      // do nothing
    }
  } // setErrorHandler(ErrorHandler)
예제 #2
0
 public void setErrorHandler(ErrorHandler errorHandler) {
   fErrorHandler = errorHandler;
   fErrorHandlerWrapper.setErrorHandler(
       errorHandler != null ? errorHandler : DraconianErrorHandler.getInstance());
   fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
 }
 /** Wraps the specified SAX error handler. */
 public ErrorHandlerWrapper(ErrorHandler errorHandler) {
   setErrorHandler(errorHandler);
 } // <init>(ErrorHandler)