Methods Summary |
---|
public org.apache.xerces.xni.parser.XMLErrorHandler | getErrorHandler()Get the internal XMLErrrorHandler.
return fErrorHandler;
|
public boolean | getFeature(java.lang.String featureId)
//
// 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 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.
for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
if (RECOGNIZED_FEATURES[i].equals(featureId)) {
return FEATURE_DEFAULTS[i];
}
}
return null;
|
public java.util.Locale | getLocale()Gets the current locale.
return fLocale ;
|
public org.apache.xerces.util.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.
return (MessageFormatter)fMessageFormatters.get(domain);
|
public 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.
for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
return PROPERTY_DEFAULTS[i];
}
}
return null;
|
public java.lang.String[] | getRecognizedFeatures()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.
return (String[])(RECOGNIZED_FEATURES.clone());
|
public java.lang.String[] | getRecognizedProperties()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.
return (String[])(RECOGNIZED_PROPERTIES.clone());
|
public org.xml.sax.ErrorHandler | getSAXErrorHandler()Gets the internal XMLErrorHandler
as SAX ErrorHandler.
if (fSaxProxy == null) {
fSaxProxy = new ErrorHandlerProxy() {
protected XMLErrorHandler getErrorHandler() {
return fErrorHandler;
}
};
}
return fSaxProxy;
|
public void | putMessageFormatter(java.lang.String domain, org.apache.xerces.util.MessageFormatter 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.
fMessageFormatters.put(domain, messageFormatter);
|
public org.apache.xerces.util.MessageFormatter | removeMessageFormatter(java.lang.String domain)Removes the message formatter for the specified domain and
returns the removed message formatter.
return (MessageFormatter) fMessageFormatters.remove(domain);
|
public void | 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.
reportError(location, domain, key, arguments, severity, null);
|
public void | 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.
// 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;
}
}
|
public void | reportError(java.lang.String domain, java.lang.String key, java.lang.Object[] arguments, short 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.
reportError(fLocator, domain, key, arguments, severity);
|
public void | reportError(java.lang.String domain, java.lang.String key, java.lang.Object[] arguments, short severity, java.lang.Exception 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.
reportError(fLocator, domain, key, arguments, severity, exception);
|
public void | reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)Resets the component. The component can query the component manager
about any features and properties that affect the operation of the
component.
// features
try {
fContinueAfterFatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR);
}
catch (XNIException e) {
fContinueAfterFatalError = false;
}
// properties
fErrorHandler = (XMLErrorHandler)componentManager.getProperty(ERROR_HANDLER);
|
public void | setDocumentLocator(org.apache.xerces.xni.XMLLocator locator)Sets the document locator.
fLocator = locator;
|
public void | setFeature(java.lang.String featureId, boolean state)Sets the state of a feature. This method is called by the component
manager any time after reset when a feature changes state.
Note: Components should silently ignore features
that do not affect the operation of the component.
//
// 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(java.util.Locale locale)Sets the current locale.
fLocale = locale;
|
public void | setProperty(java.lang.String propertyId, java.lang.Object 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.
//
// 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;
}
}
|