com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSAXParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #2
Source File: XMLErrorReporter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
        }
    }

}
 
Example #3
Source File: AbstractSAXParser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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;

}
 
Example #4
Source File: DOMParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #5
Source File: DOMParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #6
Source File: AbstractSAXParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #7
Source File: DOMParser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #8
Source File: DOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #9
Source File: AbstractSAXParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example #10
Source File: DOMParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #11
Source File: AbstractSAXParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #12
Source File: AbstractSAXParser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #13
Source File: AbstractSAXParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
    }

}
 
Example #14
Source File: ErrorHandlerProxy.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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));
    }
}
 
Example #15
Source File: ErrorHandlerProxy.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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));
    }
}
 
Example #16
Source File: ErrorHandlerProxy.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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));
    }
}
 
Example #17
Source File: ErrorHandlerProxy.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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));
    }
}
 
Example #18
Source File: XPointerHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public XPointerHandler(SymbolTable symbolTable,
        XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
    super();

    fXPointerParts = new Vector();
    fSymbolTable = symbolTable;
    fErrorHandler = errorHandler;
    fXPointerErrorReporter = errorReporter;
    //fErrorReporter = errorReporter; // The XInclude ErrorReporter
}
 
Example #19
Source File: ErrorHandlerProxy.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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));
    }
}
 
Example #20
Source File: ErrorHandlerProxy.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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?
}
 
Example #21
Source File: XPointerHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public XPointerHandler(SymbolTable symbolTable,
        XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
    super();

    fXPointerParts = new Vector();
    fSymbolTable = symbolTable;
    fErrorHandler = errorHandler;
    fXPointerErrorReporter = errorReporter;
    //fErrorReporter = errorReporter; // The XInclude ErrorReporter
}
 
Example #22
Source File: XPointerHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public XPointerHandler(SymbolTable symbolTable,
        XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
    super();

    fXPointerParts = new Vector();
    fSymbolTable = symbolTable;
    fErrorHandler = errorHandler;
    fXPointerErrorReporter = errorReporter;
    //fErrorReporter = errorReporter; // The XInclude ErrorReporter
}
 
Example #23
Source File: ErrorHandlerProxy.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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?
}
 
Example #24
Source File: XMLErrorReporter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the internal XMLErrrorHandler.
 */
public XMLErrorHandler getErrorHandler() {
    return fErrorHandler;
}
 
Example #25
Source File: XMLGrammarPreparser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler() {
    return fErrorReporter.getErrorHandler();
}
 
Example #26
Source File: XMLSchemaLoader.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler() {
    return fErrorReporter.getErrorHandler();
}
 
Example #27
Source File: XMLGrammarPreparser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler() {
    return fErrorReporter.getErrorHandler();
}
 
Example #28
Source File: XMLSchemaLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler() {
    return fErrorReporter.getErrorHandler();
}
 
Example #29
Source File: XMLGrammarPreparser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler() {
    return fErrorReporter.getErrorHandler();
}
 
Example #30
Source File: XMLGrammarLoader.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/** Returns the registered error handler.  */
public XMLErrorHandler getErrorHandler();