Method from org.apache.xerces.impl.XMLErrorReporter Detail: |
public XMLErrorHandler getErrorHandler() {
return fErrorHandler;
}
Get the internal XMLErrrorHandler. |
public boolean getFeature(String featureId) throws XMLConfigurationException {
//
// Xerces features
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
//
// http://apache.org/xml/features/continue-after-fatal-error
// Allows the parser to continue after a fatal error.
// Normally, a fatal error would stop the parse.
//
if (suffixLength == Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE.length() &&
featureId.endsWith(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
return fContinueAfterFatalError ;
}
}
return false;
}
|
public Boolean getFeatureDefault(String featureId) {
for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
if (RECOGNIZED_FEATURES[i].equals(featureId)) {
return FEATURE_DEFAULTS[i];
}
}
return null;
}
Returns the default state for a feature, or null if this
component does not want to report a default value for this
feature. |
public Locale getLocale() {
return fLocale ;
}
|
public MessageFormatter getMessageFormatter(String domain) {
return (MessageFormatter)fMessageFormatters.get(domain);
}
Returns the message formatter associated with the specified domain,
or null if no message formatter is registered for that domain. |
public Object getPropertyDefault(String propertyId) {
for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
return PROPERTY_DEFAULTS[i];
}
}
return null;
}
Returns the default state for a property, or null if this
component does not want to report a default value for this
property. |
public String[] getRecognizedFeatures() {
return (String[])(RECOGNIZED_FEATURES.clone());
}
Returns a list of feature identifiers that are recognized by
this component. This method may return null if no features
are recognized by this component. |
public String[] getRecognizedProperties() {
return (String[])(RECOGNIZED_PROPERTIES.clone());
}
Returns a list of property identifiers that are recognized by
this component. This method may return null if no properties
are recognized by this component. |
public ErrorHandler getSAXErrorHandler() {
if (fSaxProxy == null) {
fSaxProxy = new ErrorHandlerProxy() {
protected XMLErrorHandler getErrorHandler() {
return fErrorHandler;
}
};
}
return fSaxProxy;
}
Gets the internal XMLErrorHandler
as SAX ErrorHandler. |
public void putMessageFormatter(String domain,
MessageFormatter messageFormatter) {
fMessageFormatters.put(domain, messageFormatter);
}
Registers a message formatter for the specified domain.
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. |
public MessageFormatter removeMessageFormatter(String domain) {
return (MessageFormatter) fMessageFormatters.remove(domain);
}
Removes the message formatter for the specified domain and
returns the removed message formatter. |
public void reportError(String domain,
String key,
Object[] arguments,
short severity) throws XNIException {
reportError(fLocator, domain, key, arguments, severity);
}
Reports an error. The error message passed to the error handler
is formatted for the locale by the message formatter installed
for the specified error domain. |
public void reportError(String domain,
String key,
Object[] arguments,
short severity,
Exception exception) throws XNIException {
reportError(fLocator, domain, key, arguments, severity, exception);
}
Reports an error. The error message passed to the error handler
is formatted for the locale by the message formatter installed
for the specified error domain. |
public void reportError(XMLLocator location,
String domain,
String key,
Object[] arguments,
short severity) throws XNIException {
reportError(location, domain, key, arguments, severity, null);
}
Reports an error at a specific location. |
public void reportError(XMLLocator location,
String domain,
String key,
Object[] arguments,
short severity,
Exception exception) throws XNIException {
// REVISIT: [Q] Should we do anything about invalid severity
// parameter? -Ac
// format error message and create parse exception
MessageFormatter messageFormatter = getMessageFormatter(domain);
String message;
if (messageFormatter != null) {
message = messageFormatter.formatMessage(fLocale, key, arguments);
}
else {
StringBuffer str = new StringBuffer();
str.append(domain);
str.append('#");
str.append(key);
int argCount = arguments != null ? arguments.length : 0;
if (argCount > 0) {
str.append('?");
for (int i = 0; i < argCount; i++) {
str.append(arguments[i]);
if (i < argCount -1) {
str.append('&");
}
}
}
message = str.toString();
}
XMLParseException parseException = (exception != null) ?
new XMLParseException(location, message, exception) :
new XMLParseException(location, message);
// get error handler
XMLErrorHandler errorHandler = fErrorHandler;
if (errorHandler == null) {
if (fDefaultErrorHandler == null) {
fDefaultErrorHandler = new DefaultErrorHandler();
}
errorHandler = fDefaultErrorHandler;
}
// call error handler
switch (severity) {
case SEVERITY_WARNING: {
errorHandler.warning(domain, key, parseException);
break;
}
case SEVERITY_ERROR: {
errorHandler.error(domain, key, parseException);
break;
}
case SEVERITY_FATAL_ERROR: {
errorHandler.fatalError(domain, key, parseException);
if (!fContinueAfterFatalError) {
throw parseException;
}
break;
}
}
}
Reports an error at a specific location. |
public void reset(XMLComponentManager componentManager) throws XNIException {
// features
try {
fContinueAfterFatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR);
}
catch (XNIException e) {
fContinueAfterFatalError = false;
}
// properties
fErrorHandler = (XMLErrorHandler)componentManager.getProperty(ERROR_HANDLER);
}
Resets the component. The component can query the component manager
about any features and properties that affect the operation of the
component. |
public void setDocumentLocator(XMLLocator locator) {
fLocator = locator;
}
Sets the document locator. |
public void setFeature(String featureId,
boolean state) throws XMLConfigurationException {
//
// Xerces features
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
//
// http://apache.org/xml/features/continue-after-fatal-error
// Allows the parser to continue after a fatal error.
// Normally, a fatal error would stop the parse.
//
if (suffixLength == Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE.length() &&
featureId.endsWith(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
fContinueAfterFatalError = state;
}
}
}
|
public void setLocale(Locale locale) {
fLocale = locale;
}
|
public void setProperty(String propertyId,
Object value) throws XMLConfigurationException {
//
// Xerces properties
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
if (suffixLength == Constants.ERROR_HANDLER_PROPERTY.length() &&
propertyId.endsWith(Constants.ERROR_HANDLER_PROPERTY)) {
fErrorHandler = (XMLErrorHandler)value;
}
}
}
Sets the value of a property. This method is called by the component
manager any time after reset when a property changes value.
Note: Components should silently ignore properties
that do not affect the operation of the component. |