本文整理汇总了Java中org.apache.xerces.xni.parser.XMLErrorHandler类的典型用法代码示例。如果您正苦于以下问题:Java XMLErrorHandler类的具体用法?Java XMLErrorHandler怎么用?Java XMLErrorHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLErrorHandler类属于org.apache.xerces.xni.parser包,在下文中一共展示了XMLErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValidatorImpl
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
ValidatorImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool, PropertyMap properties) {
this.symbolTable = symbolTable;
XMLErrorHandler errorHandlerWrapper = new ErrorHandlerWrapper(properties.get(ValidateProperty.ERROR_HANDLER));
components = new XMLComponent[] { errorReporter, schemaValidator, entityManager };
for (int i = 0; i < components.length; i++) {
addRecognizedFeatures(components[i].getRecognizedFeatures());
addRecognizedProperties(components[i].getRecognizedProperties());
}
addRecognizedFeatures(recognizedFeatures);
addRecognizedProperties(recognizedProperties);
setFeature(Features.SCHEMA_AUGMENT_PSVI, false);
setFeature(Features.SCHEMA_FULL_CHECKING, true);
setFeature(Features.VALIDATION, true);
setFeature(Features.SCHEMA_VALIDATION, true);
setFeature(Features.ID_IDREF_CHECKING, true);
setFeature(Features.IDC_CHECKING, true);
setProperty(Properties.XMLGRAMMAR_POOL, grammarPool);
setProperty(Properties.SYMBOL_TABLE, symbolTable);
errorReporter.setDocumentLocator(this);
setProperty(Properties.ERROR_REPORTER, errorReporter);
setProperty(Properties.ERROR_HANDLER, errorHandlerWrapper);
setProperty(Properties.VALIDATION_MANAGER, validationManager);
setProperty(Properties.ENTITY_MANAGER, entityManager);
setProperty(Properties.ENTITY_RESOLVER, this);
reset();
}
示例2: setErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* 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>
*
* <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.</p>
*
* @param errorHandler The error handler.
* @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
}
}
示例3: getErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* Return the current error handler.
*
* @return The current error handler, or null if none
* has been registered.
* @see #setErrorHandler
*/
public ErrorHandler getErrorHandler() {
ErrorHandler errorHandler = null;
try {
XMLErrorHandler xmlErrorHandler =
(XMLErrorHandler)fConfiguration.getProperty(ERROR_HANDLER);
if (xmlErrorHandler != null &&
xmlErrorHandler instanceof ErrorHandlerWrapper) {
errorHandler = ((ErrorHandlerWrapper)xmlErrorHandler).getErrorHandler();
}
}
catch (XMLConfigurationException e) {
// do nothing
}
return errorHandler;
}
示例4: setErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* 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>
*
* <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.</p>
*
* @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
}
}
示例5: reset
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* Resets the component. The component can query the component manager
* about any features and properties that affect the operation of the
* component.
*
* @param componentManager The component manager.
*
* @throws 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.
*/
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);
}
示例6: setProperty
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* Sets the value of a property. This method is called by the component
* manager any time after reset when a property changes value.
* <p>
* <strong>Note:</strong> Components should silently ignore properties
* that do not affect the operation of the component.
*
* @param propertyId The property identifier.
* @param value The value of the property.
*
* @throws SAXNotRecognizedException The component should not throw
* this exception.
* @throws SAXNotSupportedException The component should not throw
* this exception.
*/
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;
}
}
}
示例7: getErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* Return the current error handler.
*
* @return The current error handler, or null if none
* has been registered.
* @see #setErrorHandler
*/
public ErrorHandler getErrorHandler() {
ErrorHandler errorHandler = null;
try {
XMLErrorHandler xmlErrorHandler =
(XMLErrorHandler)fParserConfiguration.getProperty(ERROR_HANDLER);
if (xmlErrorHandler != null &&
xmlErrorHandler instanceof ErrorHandlerWrapper) {
errorHandler = ((ErrorHandlerWrapper)xmlErrorHandler).getErrorHandler();
}
}
catch (XMLConfigurationException e) {
// do nothing
}
return errorHandler;
}
示例8: error
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
public void error(SAXParseException e) throws SAXException {
XMLErrorHandler eh = getErrorHandler();
if (eh instanceof ErrorHandlerWrapper) {
((ErrorHandlerWrapper)eh).fErrorHandler.error(e);
}
else {
eh.error("","",ErrorHandlerWrapper.createXMLParseException(e));
}
// if an XNIException is thrown, just let it go.
// REVISIT: is this OK? or should we try to wrap it into SAXException?
}
示例9: fatalError
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
public void fatalError(SAXParseException e) throws SAXException {
XMLErrorHandler eh = getErrorHandler();
if (eh instanceof ErrorHandlerWrapper) {
((ErrorHandlerWrapper)eh).fErrorHandler.fatalError(e);
}
else {
eh.fatalError("","",ErrorHandlerWrapper.createXMLParseException(e));
}
}
示例10: warning
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
public void warning(SAXParseException e) throws SAXException {
XMLErrorHandler eh = getErrorHandler();
if (eh instanceof ErrorHandlerWrapper) {
((ErrorHandlerWrapper)eh).fErrorHandler.warning(e);
}
else {
eh.warning("","",ErrorHandlerWrapper.createXMLParseException(e));
}
}
示例11: createAnnotationValidator
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
private void createAnnotationValidator() {
fAnnotationValidator = new XML11Configuration();
fGrammarBucketAdapter = new XSAnnotationGrammarPool();
fAnnotationValidator.setFeature(VALIDATION, true);
fAnnotationValidator.setFeature(XMLSCHEMA_VALIDATION, true);
fAnnotationValidator.setProperty(XMLGRAMMAR_POOL, fGrammarBucketAdapter);
/** Set error handler. **/
XMLErrorHandler errorHandler = fErrorReporter.getErrorHandler();
fAnnotationValidator.setProperty(ERROR_HANDLER, (errorHandler != null) ? errorHandler : new DefaultErrorHandler());
/** Set locale. **/
Locale locale = fErrorReporter.getLocale();
fAnnotationValidator.setProperty(LOCALE, locale);
}
示例12: getSAXErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/**
* Gets the internal XMLErrorHandler
* as SAX ErrorHandler.
*/
public ErrorHandler getSAXErrorHandler() {
if (fSaxProxy == null) {
fSaxProxy = new ErrorHandlerProxy() {
protected XMLErrorHandler getErrorHandler() {
return fErrorHandler;
}
};
}
return fSaxProxy;
}
示例13: XPointerHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
public XPointerHandler(SymbolTable symbolTable,
XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
super();
fXPointerParts = new ArrayList();
fSymbolTable = symbolTable;
fErrorHandler = errorHandler;
fXPointerErrorReporter = errorReporter;
//fErrorReporter = errorReporter; // The XInclude ErrorReporter
}
示例14: getErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/** Returns the registered error handler. */
public XMLErrorHandler getErrorHandler();
示例15: getErrorHandler
import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/** Returns the registered error handler. */
public XMLErrorHandler getErrorHandler() {
return fErrorReporter.getErrorHandler();
}