当前位置: 首页>>代码示例>>Java>>正文


Java XMLErrorHandler类代码示例

本文整理汇总了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();
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:27,代码来源:ValidatorImpl.java

示例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
    }

}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:35,代码来源:AbstractSAXParserMMImpl.java

示例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;

}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:25,代码来源:AbstractSAXParserMMImpl.java

示例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
    }

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:37,代码来源:DOMParser.java

示例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);

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:30,代码来源:XMLErrorReporter.java

示例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;
        }
    }

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:33,代码来源:XMLErrorReporter.java

示例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;

}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:25,代码来源:DOMFragmentParser.java

示例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?
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:12,代码来源:ErrorHandlerProxy.java

示例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));
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:ErrorHandlerProxy.java

示例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));
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:ErrorHandlerProxy.java

示例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);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:14,代码来源:XSDHandler.java

示例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;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:15,代码来源:XMLErrorReporter.java

示例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
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:11,代码来源:XPointerHandler.java

示例14: getErrorHandler

import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler();
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:3,代码来源:XMLGrammarLoader.java

示例15: getErrorHandler

import org.apache.xerces.xni.parser.XMLErrorHandler; //导入依赖的package包/类
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler() {
    return fErrorReporter.getErrorHandler();
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:5,代码来源:XMLGrammarPreparser.java


注:本文中的org.apache.xerces.xni.parser.XMLErrorHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。