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


Java XMLErrorHandler类代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler的典型用法代码示例。如果您正苦于以下问题:Java XMLErrorHandler类的具体用法?Java XMLErrorHandler怎么用?Java XMLErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XMLErrorHandler类属于com.sun.org.apache.xerces.internal.xni.parser包,在下文中一共展示了XMLErrorHandler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setErrorHandler

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:AbstractSAXParser.java

示例2: getErrorHandler

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:AbstractSAXParser.java

示例3: setErrorHandler

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:DOMParser.java

示例4: setProperty

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:XMLErrorReporter.java

示例5: error

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ErrorHandlerProxy.java

示例6: fatalError

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:ErrorHandlerProxy.java

示例7: warning

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:ErrorHandlerProxy.java

示例8: createAnnotationValidator

import com.sun.org.apache.xerces.internal.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:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XSDHandler.java

示例9: XPointerHandler

import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; //导入依赖的package包/类
public XPointerHandler(SymbolTable symbolTable,
        XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
    super();

    fXPointerParts = new Vector();
    fSymbolTable = symbolTable;
    fErrorHandler = errorHandler;
    fXPointerErrorReporter = errorReporter;
    //fErrorReporter = errorReporter; // The XInclude ErrorReporter
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XPointerHandler.java


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