public class XMLErrorReporter
extends java.lang.Object
implements org.apache.xerces.xni.parser.XMLComponent
http://apache.org/xml/properties/internal/error-reporter
 Errors are separated into domains that categorize a class of errors.
 In a parser configuration, the parser would register a
 MessageFormatter for each domain that is capable of
 localizing error messages and formatting them based on information 
 about the error. Any parser component can invent new error domains
 and register additional message formatters to localize messages in
 those domains.
 
This component requires the following features and properties from the component manager that uses it:
This component can use the following features and properties but they are not required:
MessageFormatter| Modifier and Type | Field and Description | 
|---|---|
| protected static java.lang.String | CONTINUE_AFTER_FATAL_ERRORFeature identifier: continue after fatal error. | 
| protected static java.lang.String | ERROR_HANDLERProperty identifier: error handler. | 
| protected boolean | fContinueAfterFatalErrorContinue after fatal error feature. | 
| protected org.apache.xerces.xni.parser.XMLErrorHandler | fDefaultErrorHandlerDefault error handler. | 
| protected org.apache.xerces.xni.parser.XMLErrorHandler | fErrorHandlerError handler. | 
| protected java.util.Locale | fLocaleThe locale to be used to format error messages. | 
| protected org.apache.xerces.xni.XMLLocator | fLocatorDocument locator. | 
| protected java.util.Hashtable | fMessageFormattersMapping of Message formatters for domains. | 
| static short | SEVERITY_ERRORSeverity: error. | 
| static short | SEVERITY_FATAL_ERRORSeverity: fatal error. | 
| static short | SEVERITY_WARNINGSeverity: warning. | 
| Constructor and Description | 
|---|
| XMLErrorReporter()Constructs an error reporter with a locator. | 
| Modifier and Type | Method and Description | 
|---|---|
| org.apache.xerces.xni.parser.XMLErrorHandler | getErrorHandler()Get the internal XMLErrrorHandler. | 
| boolean | getFeature(java.lang.String featureId) | 
| java.lang.Boolean | getFeatureDefault(java.lang.String featureId)Returns the default state for a feature, or null if this
 component does not want to report a default value for this
 feature. | 
| java.util.Locale | getLocale()Gets the current locale. | 
| MessageFormatter | getMessageFormatter(java.lang.String domain)Returns the message formatter associated with the specified domain,
 or null if no message formatter is registered for that domain. | 
| java.lang.Object | getPropertyDefault(java.lang.String propertyId)Returns the default state for a property, or null if this
 component does not want to report a default value for this
 property. | 
| java.lang.String[] | getRecognizedFeatures()Returns a list of feature identifiers that are recognized by
 this component. | 
| java.lang.String[] | getRecognizedProperties()Returns a list of property identifiers that are recognized by
 this component. | 
| org.xml.sax.ErrorHandler | getSAXErrorHandler()Gets the internal XMLErrorHandler
 as SAX ErrorHandler. | 
| void | putMessageFormatter(java.lang.String domain,
                   MessageFormatter messageFormatter)Registers a message formatter for the specified domain. | 
| MessageFormatter | removeMessageFormatter(java.lang.String domain)Removes the message formatter for the specified domain and
 returns the removed message formatter. | 
| java.lang.String | reportError(java.lang.String domain,
           java.lang.String key,
           java.lang.Object[] arguments,
           short severity)Reports an error. | 
| java.lang.String | reportError(java.lang.String domain,
           java.lang.String key,
           java.lang.Object[] arguments,
           short severity,
           java.lang.Exception exception)Reports an error. | 
| java.lang.String | reportError(org.apache.xerces.xni.XMLLocator location,
           java.lang.String domain,
           java.lang.String key,
           java.lang.Object[] arguments,
           short severity)Reports an error at a specific location. | 
| java.lang.String | reportError(org.apache.xerces.xni.XMLLocator location,
           java.lang.String domain,
           java.lang.String key,
           java.lang.Object[] arguments,
           short severity,
           java.lang.Exception exception)Reports an error at a specific location. | 
| void | reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)Resets the component. | 
| void | setDocumentLocator(org.apache.xerces.xni.XMLLocator locator)Sets the document locator. | 
| void | setFeature(java.lang.String featureId,
          boolean state)Sets the state of a feature. | 
| void | setLocale(java.util.Locale locale)Sets the current locale. | 
| void | setProperty(java.lang.String propertyId,
           java.lang.Object value)Sets the value of a property. | 
public static final short SEVERITY_WARNING
public static final short SEVERITY_ERROR
public static final short SEVERITY_FATAL_ERROR
Note: The parser does have a "continue after fatal error" feature but it should be used with extreme caution and care.
protected static final java.lang.String CONTINUE_AFTER_FATAL_ERROR
protected static final java.lang.String ERROR_HANDLER
protected java.util.Locale fLocale
protected java.util.Hashtable fMessageFormatters
protected org.apache.xerces.xni.parser.XMLErrorHandler fErrorHandler
protected org.apache.xerces.xni.XMLLocator fLocator
protected boolean fContinueAfterFatalError
protected org.apache.xerces.xni.parser.XMLErrorHandler fDefaultErrorHandler
public XMLErrorReporter()
public void setLocale(java.util.Locale locale)
locale - The new locale.public java.util.Locale getLocale()
public void setDocumentLocator(org.apache.xerces.xni.XMLLocator locator)
locator - The locator.public void putMessageFormatter(java.lang.String domain,
                       MessageFormatter messageFormatter)
Note: Registering a message formatter for a domain when there is already a formatter registered will cause the previous formatter to be lost. This method replaces any previously registered message formatter for the specified domain.
domain - messageFormatter - public MessageFormatter getMessageFormatter(java.lang.String domain)
domain - The domain of the message formatter.public MessageFormatter removeMessageFormatter(java.lang.String domain)
domain - The domain of the message formatter.public java.lang.String reportError(java.lang.String domain,
                           java.lang.String key,
                           java.lang.Object[] arguments,
                           short severity)
                             throws org.apache.xerces.xni.XNIException
domain - The error domain.key - The key of the error message.arguments - The replacement arguments for the error message,
                  if needed.severity - The severity of the error.org.apache.xerces.xni.XNIExceptionSEVERITY_WARNING, 
SEVERITY_ERROR, 
SEVERITY_FATAL_ERRORpublic java.lang.String reportError(java.lang.String domain,
                           java.lang.String key,
                           java.lang.Object[] arguments,
                           short severity,
                           java.lang.Exception exception)
                             throws org.apache.xerces.xni.XNIException
domain - The error domain.key - The key of the error message.arguments - The replacement arguments for the error message,
                  if needed.severity - The severity of the error.exception - The exception to wrap.org.apache.xerces.xni.XNIExceptionSEVERITY_WARNING, 
SEVERITY_ERROR, 
SEVERITY_FATAL_ERRORpublic java.lang.String reportError(org.apache.xerces.xni.XMLLocator location,
                           java.lang.String domain,
                           java.lang.String key,
                           java.lang.Object[] arguments,
                           short severity)
                             throws org.apache.xerces.xni.XNIException
location - The error location.domain - The error domain.key - The key of the error message.arguments - The replacement arguments for the error message,
                  if needed.severity - The severity of the error.org.apache.xerces.xni.XNIExceptionSEVERITY_WARNING, 
SEVERITY_ERROR, 
SEVERITY_FATAL_ERRORpublic java.lang.String reportError(org.apache.xerces.xni.XMLLocator location,
                           java.lang.String domain,
                           java.lang.String key,
                           java.lang.Object[] arguments,
                           short severity,
                           java.lang.Exception exception)
                             throws org.apache.xerces.xni.XNIException
location - The error location.domain - The error domain.key - The key of the error message.arguments - The replacement arguments for the error message,
                  if needed.severity - The severity of the error.exception - The exception to wrap.org.apache.xerces.xni.XNIExceptionSEVERITY_WARNING, 
SEVERITY_ERROR, 
SEVERITY_FATAL_ERRORpublic void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
           throws org.apache.xerces.xni.XNIException
reset in interface org.apache.xerces.xni.parser.XMLComponentcomponentManager - The component manager.SAXException - Thrown by component on initialization error.
                      For example, if a feature or property is
                      required for the operation of the component, the
                      component manager may throw a 
                      SAXNotRecognizedException or a
                      SAXNotSupportedException.org.apache.xerces.xni.XNIException - Thrown by component on initialization error.public java.lang.String[] getRecognizedFeatures()
getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponentpublic void setFeature(java.lang.String featureId,
              boolean state)
                throws org.apache.xerces.xni.parser.XMLConfigurationException
Note: Components should silently ignore features that do not affect the operation of the component.
setFeature in interface org.apache.xerces.xni.parser.XMLComponentfeatureId - The feature identifier.state - The state of the feature.SAXNotRecognizedException - The component should not throw
                                   this exception.SAXNotSupportedException - The component should not throw
                                  this exception.org.apache.xerces.xni.parser.XMLConfigurationException - Thrown for configuration error.
                                   In general, components should
                                   only throw this exception if
                                   it is really
                                   a critical error.public boolean getFeature(java.lang.String featureId)
                   throws org.apache.xerces.xni.parser.XMLConfigurationException
org.apache.xerces.xni.parser.XMLConfigurationExceptionpublic java.lang.String[] getRecognizedProperties()
getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponentpublic void setProperty(java.lang.String propertyId,
               java.lang.Object value)
                 throws org.apache.xerces.xni.parser.XMLConfigurationException
Note: Components should silently ignore properties that do not affect the operation of the component.
setProperty in interface org.apache.xerces.xni.parser.XMLComponentpropertyId - The property identifier.value - The value of the property.SAXNotRecognizedException - The component should not throw
                                   this exception.SAXNotSupportedException - The component should not throw
                                  this exception.org.apache.xerces.xni.parser.XMLConfigurationException - Thrown for configuration error.
                                   In general, components should
                                   only throw this exception if
                                   it is really
                                   a critical error.public java.lang.Boolean getFeatureDefault(java.lang.String featureId)
getFeatureDefault in interface org.apache.xerces.xni.parser.XMLComponentfeatureId - The feature identifier.public java.lang.Object getPropertyDefault(java.lang.String propertyId)
getPropertyDefault in interface org.apache.xerces.xni.parser.XMLComponentpropertyId - The property identifier.public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
public org.xml.sax.ErrorHandler getSAXErrorHandler()
Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.