286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * The Apache Software License, Version 1.1
286N/A *
286N/A *
286N/A * Copyright (c) 1999-2004 The Apache Software Foundation.
286N/A * All rights reserved.
286N/A *
286N/A * Redistribution and use in source and binary forms, with or without
286N/A * modification, are permitted provided that the following conditions
286N/A * are met:
286N/A *
286N/A * 1. Redistributions of source code must retain the above copyright
286N/A * notice, this list of conditions and the following disclaimer.
286N/A *
286N/A * 2. Redistributions in binary form must reproduce the above copyright
286N/A * notice, this list of conditions and the following disclaimer in
286N/A * the documentation and/or other materials provided with the
286N/A * distribution.
286N/A *
286N/A * 3. The end-user documentation included with the redistribution,
286N/A * if any, must include the following acknowledgment:
286N/A * "This product includes software developed by the
286N/A * Apache Software Foundation (http://www.apache.org/)."
286N/A * Alternately, this acknowledgment may appear in the software itself,
286N/A * if and wherever such third-party acknowledgments normally appear.
286N/A *
286N/A * 4. The names "Xerces" and "Apache Software Foundation" must
286N/A * not be used to endorse or promote products derived from this
286N/A * software without prior written permission. For written
286N/A * permission, please contact apache@apache.org.
286N/A *
286N/A * 5. Products derived from this software may not be called "Apache",
286N/A * nor may "Apache" appear in their name, without prior written
286N/A * permission of the Apache Software Foundation.
286N/A *
286N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
286N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
286N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
286N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
286N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
286N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
286N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
286N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
286N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
286N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
286N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
286N/A * SUCH DAMAGE.
286N/A * ====================================================================
286N/A *
286N/A * This software consists of voluntary contributions made by many
286N/A * individuals on behalf of the Apache Software Foundation and was
286N/A * originally based on software copyright (c) 1999, International
286N/A * Business Machines, Inc., http://www.apache.org. For more
286N/A * information on the Apache Software Foundation, please see
286N/A * <http://www.apache.org/>.
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xerces.internal.impl;
286N/Aimport java.util.Hashtable;
286N/Aimport java.util.Locale;
286N/A
286N/Aimport com.sun.org.apache.xerces.internal.util.DefaultErrorHandler;
286N/Aimport com.sun.org.apache.xerces.internal.util.ErrorHandlerProxy;
286N/Aimport com.sun.org.apache.xerces.internal.util.MessageFormatter;
286N/Aimport com.sun.org.apache.xerces.internal.xni.XMLLocator;
286N/Aimport com.sun.org.apache.xerces.internal.xni.XNIException;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
286N/Aimport org.xml.sax.ErrorHandler;
286N/A
286N/A/**
286N/A * This class is a common element of all parser configurations and is
286N/A * used to report errors that occur. This component can be queried by
286N/A * parser components from the component manager using the following
286N/A * property ID:
286N/A * <pre>
286N/A * http://apache.org/xml/properties/internal/error-reporter
286N/A * </pre>
286N/A * <p>
286N/A * Errors are separated into domains that categorize a class of errors.
286N/A * In a parser configuration, the parser would register a
286N/A * <code>MessageFormatter</code> for each domain that is capable of
286N/A * localizing error messages and formatting them based on information
286N/A * about the error. Any parser component can invent new error domains
286N/A * and register additional message formatters to localize messages in
286N/A * those domains.
286N/A * <p>
286N/A * This component requires the following features and properties from the
286N/A * component manager that uses it:
286N/A * <ul>
286N/A * <li>http://apache.org/xml/properties/internal/error-handler</li>
286N/A * </ul>
286N/A * <p>
286N/A * This component can use the following features and properties but they
286N/A * are not required:
286N/A * <ul>
286N/A * <li>http://apache.org/xml/features/continue-after-fatal-error</li>
286N/A * </ul>
286N/A *
286N/A * @xerces.internal
286N/A *
286N/A * @see MessageFormatter
286N/A *
286N/A * @author Eric Ye, IBM
286N/A * @author Andy Clark, IBM
286N/A *
286N/A * @version $Id: XMLErrorReporter.java,v 1.5 2010-11-01 04:39:41 joehw Exp $
286N/A */
286N/Apublic class XMLErrorReporter
286N/A implements XMLComponent {
286N/A
286N/A //
286N/A // Constants
286N/A //
286N/A
286N/A // severity
286N/A
286N/A /**
286N/A * Severity: warning. Warnings represent informational messages only
286N/A * that should not be considered serious enough to stop parsing or
286N/A * indicate an error in the document's validity.
286N/A */
286N/A public static final short SEVERITY_WARNING = 0;
286N/A
286N/A /**
286N/A * Severity: error. Common causes of errors are document structure and/or
286N/A * content that that does not conform to the grammar rules specified for
286N/A * the document. These are typically validation errors.
286N/A */
286N/A public static final short SEVERITY_ERROR = 1;
286N/A
286N/A /**
286N/A * Severity: fatal error. Fatal errors are errors in the syntax of the
286N/A * XML document or invalid byte sequences for a given encoding. The
286N/A * XML 1.0 Specification mandates that errors of this type are not
286N/A * recoverable.
286N/A * <p>
286N/A * <strong>Note:</strong> The parser does have a "continue after fatal
286N/A * error" feature but it should be used with extreme caution and care.
286N/A */
286N/A public static final short SEVERITY_FATAL_ERROR = 2;
286N/A
286N/A // feature identifiers
286N/A
286N/A /** Feature identifier: continue after fatal error. */
286N/A protected static final String CONTINUE_AFTER_FATAL_ERROR =
286N/A Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;
286N/A
286N/A // property identifiers
286N/A
286N/A /** Property identifier: error handler. */
286N/A protected static final String ERROR_HANDLER =
286N/A Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
286N/A
286N/A // recognized features and properties
286N/A
286N/A /** Recognized features. */
286N/A private static final String[] RECOGNIZED_FEATURES = {
286N/A CONTINUE_AFTER_FATAL_ERROR,
286N/A };
286N/A
286N/A /** Feature defaults. */
286N/A private static final Boolean[] FEATURE_DEFAULTS = {
286N/A null,
286N/A };
286N/A
286N/A /** Recognized properties. */
286N/A private static final String[] RECOGNIZED_PROPERTIES = {
286N/A ERROR_HANDLER,
286N/A };
286N/A
286N/A /** Property defaults. */
286N/A private static final Object[] PROPERTY_DEFAULTS = {
286N/A null,
286N/A };
286N/A
286N/A //
286N/A // Data
286N/A //
286N/A
286N/A /** The locale to be used to format error messages. */
286N/A protected Locale fLocale;
286N/A
286N/A /** Mapping of Message formatters for domains. */
286N/A protected Hashtable fMessageFormatters;
286N/A
286N/A /** Error handler. */
286N/A protected XMLErrorHandler fErrorHandler;
286N/A
286N/A /** Document locator. */
286N/A protected XMLLocator fLocator;
286N/A
286N/A /** Continue after fatal error feature. */
286N/A protected boolean fContinueAfterFatalError;
286N/A
286N/A /**
286N/A * Default error handler. This error handler is only used in the
286N/A * absence of a registered error handler so that errors are not
286N/A * "swallowed" silently. This is one of the most common "problems"
286N/A * reported by users of the parser.
286N/A */
286N/A protected XMLErrorHandler fDefaultErrorHandler;
286N/A
286N/A /** A SAX proxy to the error handler contained in this error reporter. */
286N/A private ErrorHandler fSaxProxy = null;
286N/A
286N/A //
286N/A // Constructors
286N/A //
286N/A
286N/A /** Constructs an error reporter with a locator. */
286N/A public XMLErrorReporter() {
286N/A
286N/A // REVISIT: [Q] Should the locator be passed to the reportError
286N/A // method? Otherwise, there is no way for a parser
286N/A // component to store information about where an
286N/A // error occurred so as to report it later.
286N/A //
286N/A // An example would be to record the location of
286N/A // IDREFs so that, at the end of the document, if
286N/A // there is no associated ID declared, the error
286N/A // could report the location information of the
286N/A // reference. -Ac
286N/A //
286N/A // NOTE: I added another reportError method that allows the
286N/A // caller to specify the location of the error being
286N/A // reported. -Ac
286N/A
286N/A fMessageFormatters = new Hashtable();
286N/A
286N/A } // <init>()
286N/A
286N/A //
286N/A // Methods
286N/A //
286N/A
286N/A /**
286N/A * Sets the current locale.
286N/A *
286N/A * @param locale The new locale.
286N/A */
286N/A public void setLocale(Locale locale) {
286N/A fLocale = locale;
286N/A } // setLocale(Locale)
286N/A
286N/A /**
286N/A * Gets the current locale.
286N/A *
286N/A * @return the current Locale
286N/A */
286N/A public Locale getLocale() {
286N/A return fLocale ;
286N/A } // getLocale(): Locale
286N/A
286N/A /**
286N/A * Sets the document locator.
286N/A *
286N/A * @param locator The locator.
286N/A */
286N/A public void setDocumentLocator(XMLLocator locator) {
286N/A fLocator = locator;
286N/A } // setDocumentLocator(XMLLocator)
286N/A
286N/A /**
286N/A * Registers a message formatter for the specified domain.
286N/A * <p>
286N/A * <strong>Note:</strong> Registering a message formatter for a domain
286N/A * when there is already a formatter registered will cause the previous
286N/A * formatter to be lost. This method replaces any previously registered
286N/A * message formatter for the specified domain.
286N/A *
286N/A * @param domain
286N/A * @param messageFormatter
286N/A */
286N/A public void putMessageFormatter(String domain,
286N/A MessageFormatter messageFormatter) {
286N/A fMessageFormatters.put(domain, messageFormatter);
286N/A } // putMessageFormatter(String,MessageFormatter)
286N/A
286N/A /**
286N/A * Returns the message formatter associated with the specified domain,
286N/A * or null if no message formatter is registered for that domain.
286N/A *
286N/A * @param domain The domain of the message formatter.
286N/A */
286N/A public MessageFormatter getMessageFormatter(String domain) {
286N/A return (MessageFormatter)fMessageFormatters.get(domain);
286N/A } // getMessageFormatter(String):MessageFormatter
286N/A
286N/A /**
286N/A * Removes the message formatter for the specified domain and
286N/A * returns the removed message formatter.
286N/A *
286N/A * @param domain The domain of the message formatter.
286N/A */
286N/A public MessageFormatter removeMessageFormatter(String domain) {
286N/A return (MessageFormatter) fMessageFormatters.remove(domain);
286N/A } // removeMessageFormatter(String):MessageFormatter
286N/A
286N/A /**
286N/A * Reports an error. The error message passed to the error handler
286N/A * is formatted for the locale by the message formatter installed
286N/A * for the specified error domain.
286N/A *
286N/A * @param domain The error domain.
286N/A * @param key The key of the error message.
286N/A * @param arguments The replacement arguments for the error message,
286N/A * if needed.
286N/A * @param severity The severity of the error.
286N/A * @return The formatted error message.
286N/A *
286N/A * @see #SEVERITY_WARNING
286N/A * @see #SEVERITY_ERROR
286N/A * @see #SEVERITY_FATAL_ERROR
286N/A */
286N/A public String reportError(String domain, String key, Object[] arguments,
286N/A short severity) throws XNIException {
286N/A return reportError(fLocator, domain, key, arguments, severity);
286N/A } // reportError(String,String,Object[],short):String
286N/A
286N/A /**
286N/A * Reports an error. The error message passed to the error handler
286N/A * is formatted for the locale by the message formatter installed
286N/A * for the specified error domain.
286N/A *
286N/A * @param domain The error domain.
286N/A * @param key The key of the error message.
286N/A * @param arguments The replacement arguments for the error message,
286N/A * if needed.
286N/A * @param severity The severity of the error.
286N/A * @param exception The exception to wrap.
286N/A * @return The formatted error message.
286N/A *
286N/A * @see #SEVERITY_WARNING
286N/A * @see #SEVERITY_ERROR
286N/A * @see #SEVERITY_FATAL_ERROR
286N/A */
286N/A public String reportError(String domain, String key, Object[] arguments,
286N/A short severity, Exception exception) throws XNIException {
286N/A return reportError(fLocator, domain, key, arguments, severity, exception);
286N/A } // reportError(String,String,Object[],short,Exception):String
286N/A
286N/A /**
286N/A * Reports an error at a specific location.
286N/A *
286N/A * @param location The error location.
286N/A * @param domain The error domain.
286N/A * @param key The key of the error message.
286N/A * @param arguments The replacement arguments for the error message,
286N/A * if needed.
286N/A * @param severity The severity of the error.
286N/A * @return The formatted error message.
286N/A *
286N/A * @see #SEVERITY_WARNING
286N/A * @see #SEVERITY_ERROR
286N/A * @see #SEVERITY_FATAL_ERROR
286N/A */
286N/A public String reportError(XMLLocator location,
286N/A String domain, String key, Object[] arguments,
286N/A short severity) throws XNIException {
286N/A return reportError(location, domain, key, arguments, severity, null);
286N/A } // reportError(XMLLocator,String,String,Object[],short):String
286N/A
286N/A /**
286N/A * Reports an error at a specific location.
286N/A *
286N/A * @param location The error location.
286N/A * @param domain The error domain.
286N/A * @param key The key of the error message.
286N/A * @param arguments The replacement arguments for the error message,
286N/A * if needed.
286N/A * @param severity The severity of the error.
286N/A * @param exception The exception to wrap.
286N/A * @return The formatted error message.
286N/A *
286N/A * @see #SEVERITY_WARNING
286N/A * @see #SEVERITY_ERROR
286N/A * @see #SEVERITY_FATAL_ERROR
286N/A */
286N/A public String reportError(XMLLocator location,
286N/A String domain, String key, Object[] arguments,
286N/A short severity, Exception exception) throws XNIException {
286N/A
286N/A // REVISIT: [Q] Should we do anything about invalid severity
286N/A // parameter? -Ac
286N/A
286N/A // format error message and create parse exception
286N/A MessageFormatter messageFormatter = getMessageFormatter(domain);
286N/A String message;
286N/A if (messageFormatter != null) {
286N/A message = messageFormatter.formatMessage(fLocale, key, arguments);
286N/A }
286N/A else {
286N/A StringBuffer str = new StringBuffer();
286N/A str.append(domain);
286N/A str.append('#');
286N/A str.append(key);
286N/A int argCount = arguments != null ? arguments.length : 0;
286N/A if (argCount > 0) {
286N/A str.append('?');
286N/A for (int i = 0; i < argCount; i++) {
286N/A str.append(arguments[i]);
286N/A if (i < argCount -1) {
286N/A str.append('&');
286N/A }
286N/A }
286N/A }
286N/A message = str.toString();
286N/A }
286N/A XMLParseException parseException = (exception != null) ?
286N/A new XMLParseException(location, message, exception) :
286N/A new XMLParseException(location, message);
286N/A
286N/A // get error handler
286N/A XMLErrorHandler errorHandler = fErrorHandler;
286N/A if (errorHandler == null) {
286N/A if (fDefaultErrorHandler == null) {
286N/A fDefaultErrorHandler = new DefaultErrorHandler();
286N/A }
286N/A errorHandler = fDefaultErrorHandler;
286N/A }
286N/A
286N/A // call error handler
286N/A switch (severity) {
286N/A case SEVERITY_WARNING: {
286N/A errorHandler.warning(domain, key, parseException);
286N/A break;
286N/A }
286N/A case SEVERITY_ERROR: {
286N/A errorHandler.error(domain, key, parseException);
286N/A break;
286N/A }
286N/A case SEVERITY_FATAL_ERROR: {
286N/A errorHandler.fatalError(domain, key, parseException);
286N/A if (!fContinueAfterFatalError) {
286N/A throw parseException;
286N/A }
286N/A break;
286N/A }
286N/A }
286N/A return message;
286N/A
286N/A } // reportError(XMLLocator,String,String,Object[],short,Exception):String
286N/A
286N/A //
286N/A // XMLComponent methods
286N/A //
286N/A
286N/A /**
286N/A * Resets the component. The component can query the component manager
286N/A * about any features and properties that affect the operation of the
286N/A * component.
286N/A *
286N/A * @param componentManager The component manager.
286N/A *
286N/A * @throws SAXException Thrown by component on initialization error.
286N/A * For example, if a feature or property is
286N/A * required for the operation of the component, the
286N/A * component manager may throw a
286N/A * SAXNotRecognizedException or a
286N/A * SAXNotSupportedException.
286N/A */
286N/A public void reset(XMLComponentManager componentManager)
286N/A throws XNIException {
286N/A
286N/A // features
286N/A fContinueAfterFatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR, false);
286N/A
286N/A // properties
286N/A fErrorHandler = (XMLErrorHandler)componentManager.getProperty(ERROR_HANDLER);
286N/A
286N/A } // reset(XMLComponentManager)
286N/A
286N/A /**
286N/A * Returns a list of feature identifiers that are recognized by
286N/A * this component. This method may return null if no features
286N/A * are recognized by this component.
286N/A */
286N/A public String[] getRecognizedFeatures() {
286N/A return (String[])(RECOGNIZED_FEATURES.clone());
286N/A } // getRecognizedFeatures():String[]
286N/A
286N/A /**
286N/A * Sets the state of a feature. This method is called by the component
286N/A * manager any time after reset when a feature changes state.
286N/A * <p>
286N/A * <strong>Note:</strong> Components should silently ignore features
286N/A * that do not affect the operation of the component.
286N/A *
286N/A * @param featureId The feature identifier.
286N/A * @param state The state of the feature.
286N/A *
286N/A * @throws SAXNotRecognizedException The component should not throw
286N/A * this exception.
286N/A * @throws SAXNotSupportedException The component should not throw
286N/A * this exception.
286N/A */
286N/A public void setFeature(String featureId, boolean state)
286N/A throws XMLConfigurationException {
286N/A
286N/A //
286N/A // Xerces features
286N/A //
286N/A
286N/A if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
286N/A final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
286N/A
286N/A //
286N/A // http://apache.org/xml/features/continue-after-fatal-error
286N/A // Allows the parser to continue after a fatal error.
286N/A // Normally, a fatal error would stop the parse.
286N/A //
286N/A if (suffixLength == Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE.length() &&
286N/A featureId.endsWith(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
286N/A fContinueAfterFatalError = state;
286N/A }
286N/A }
286N/A
286N/A } // setFeature(String,boolean)
286N/A
286N/A // return state of given feature or false if unsupported.
286N/A public boolean getFeature(String featureId)
286N/A throws XMLConfigurationException {
286N/A
286N/A //
286N/A // Xerces features
286N/A //
286N/A
286N/A if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
286N/A final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
286N/A
286N/A //
286N/A // http://apache.org/xml/features/continue-after-fatal-error
286N/A // Allows the parser to continue after a fatal error.
286N/A // Normally, a fatal error would stop the parse.
286N/A //
286N/A if (suffixLength == Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE.length() &&
286N/A featureId.endsWith(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
286N/A return fContinueAfterFatalError ;
286N/A }
286N/A }
286N/A return false;
286N/A
286N/A } // setFeature(String,boolean)
286N/A
286N/A /**
286N/A * Returns a list of property identifiers that are recognized by
286N/A * this component. This method may return null if no properties
286N/A * are recognized by this component.
286N/A */
286N/A public String[] getRecognizedProperties() {
286N/A return (String[])(RECOGNIZED_PROPERTIES.clone());
286N/A } // getRecognizedProperties():String[]
286N/A
286N/A /**
286N/A * Sets the value of a property. This method is called by the component
286N/A * manager any time after reset when a property changes value.
286N/A * <p>
286N/A * <strong>Note:</strong> Components should silently ignore properties
286N/A * that do not affect the operation of the component.
286N/A *
286N/A * @param propertyId The property identifier.
286N/A * @param value The value of the property.
286N/A *
286N/A * @throws SAXNotRecognizedException The component should not throw
286N/A * this exception.
286N/A * @throws SAXNotSupportedException The component should not throw
286N/A * this exception.
286N/A */
286N/A public void setProperty(String propertyId, Object value)
286N/A throws XMLConfigurationException {
286N/A
286N/A //
286N/A // Xerces properties
286N/A //
286N/A
286N/A if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
286N/A final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
286N/A
286N/A if (suffixLength == Constants.ERROR_HANDLER_PROPERTY.length() &&
286N/A propertyId.endsWith(Constants.ERROR_HANDLER_PROPERTY)) {
286N/A fErrorHandler = (XMLErrorHandler)value;
286N/A }
286N/A }
286N/A
286N/A } // setProperty(String,Object)
286N/A
286N/A /**
286N/A * Returns the default state for a feature, or null if this
286N/A * component does not want to report a default value for this
286N/A * feature.
286N/A *
286N/A * @param featureId The feature identifier.
286N/A *
286N/A * @since Xerces 2.2.0
286N/A */
286N/A public Boolean getFeatureDefault(String featureId) {
286N/A for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
286N/A if (RECOGNIZED_FEATURES[i].equals(featureId)) {
286N/A return FEATURE_DEFAULTS[i];
286N/A }
286N/A }
286N/A return null;
286N/A } // getFeatureDefault(String):Boolean
286N/A
286N/A /**
286N/A * Returns the default state for a property, or null if this
286N/A * component does not want to report a default value for this
286N/A * property.
286N/A *
286N/A * @param propertyId The property identifier.
286N/A *
286N/A * @since Xerces 2.2.0
286N/A */
286N/A public Object getPropertyDefault(String propertyId) {
286N/A for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
286N/A if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
286N/A return PROPERTY_DEFAULTS[i];
286N/A }
286N/A }
286N/A return null;
286N/A } // getPropertyDefault(String):Object
286N/A
286N/A /**
286N/A * Get the internal XMLErrrorHandler.
286N/A */
286N/A public XMLErrorHandler getErrorHandler() {
286N/A return fErrorHandler;
286N/A }
286N/A
286N/A /**
286N/A * Gets the internal XMLErrorHandler
286N/A * as SAX ErrorHandler.
286N/A */
286N/A public ErrorHandler getSAXErrorHandler() {
286N/A if (fSaxProxy == null) {
286N/A fSaxProxy = new ErrorHandlerProxy() {
286N/A protected XMLErrorHandler getErrorHandler() {
286N/A return fErrorHandler;
286N/A }
286N/A };
286N/A }
286N/A return fSaxProxy;
286N/A }
286N/A
286N/A} // class XMLErrorReporter