Examples of XmlErrorHandler


Examples of org.apache.tomcat.util.descriptor.XmlErrorHandler

            source.setByteStream(stream);
            digester.setClassLoader(this.getClass().getClassLoader());
            digester.setUseContextClassLoader(false);
            digester.push(context.getParent());
            digester.push(context);
            XmlErrorHandler errorHandler = new XmlErrorHandler();
            digester.setErrorHandler(errorHandler);
            digester.parse(source);
            if (errorHandler.getWarnings().size() > 0 ||
                    errorHandler.getErrors().size() > 0) {
                errorHandler.logFindings(log, contextXml.toString());
                ok = false;
            }
            if (log.isDebugEnabled()) {
                log.debug("Successfully processed context [" + context.getName()
                        + "] configuration file [" + contextXml + "]");
View Full Code Here

Examples of org.apache.tomcat.util.descriptor.XmlErrorHandler

        digester = DigesterFactory.newDigester(validation, namespaceAware, ruleSet);
    }

    public TaglibXml parse(TldResourcePath path) throws IOException, SAXException {
        try (InputStream is = path.openStream()) {
            XmlErrorHandler handler = new XmlErrorHandler();
            digester.setErrorHandler(handler);

            TaglibXml taglibXml = new TaglibXml();
            digester.push(taglibXml);

            InputSource source = new InputSource(path.toExternalForm());
            source.setByteStream(is);
            digester.parse(source);
            if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) {
                handler.logFindings(LOG, source.getSystemId());
                if (!handler.getErrors().isEmpty()) {
                    // throw the first to indicate there was a error during processing
                    throw handler.getErrors().iterator().next();
                }
            }
            return taglibXml;
        } finally {
            digester.reset();
View Full Code Here

Examples of org.apache.xerces.xni.parser.XMLErrorHandler

    } // reset(ErrorReporter, EntityResolver, SymbolTable, XMLGrammarPool)

    void resetSchemaParserErrorHandler() {
        if (fSchemaParser != null) {
            try {
                XMLErrorHandler currErrorHandler =
                                     fErrorReporter.getErrorHandler();
                // Setting a parser property can be much more expensive
                // than checking its value.  Don't set the ERROR_HANDLER
                // property unless it's actually changed.
                if (currErrorHandler
View Full Code Here

Examples of org.apache.xerces.xni.parser.XMLErrorHandler

     */
    public ErrorHandler getErrorHandler() {

        ErrorHandler errorHandler = null;
        try {
            XMLErrorHandler xmlErrorHandler =
                (XMLErrorHandler)fConfiguration.getProperty(ERROR_HANDLER);
            if (xmlErrorHandler != null &&
                xmlErrorHandler instanceof ErrorHandlerWrapper) {
                errorHandler = ((ErrorHandlerWrapper)xmlErrorHandler).getErrorHandler();
            }
View Full Code Here

Examples of org.dom4j.util.XMLErrorHandler

            log.error(e.toString(), true);
        }
    }

    private boolean validXML(File xmlFile, File xsdFile) {
        XMLErrorHandler errorHandler = new XMLErrorHandler();
        try {
            if (reader == null) {
                reader = new SAXReader();
                reader.setValidation(true);
                reader.setFeature("http://xml.org/sax/features/validation", true);
                reader.setFeature("http://apache.org/xml/features/validation/schema", true);
                reader.setProperty("http://apache.org/xml/properties/input-buffer-size", 8 * 1024);
            }
            reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                    xsdFile.getAbsolutePath());
            reader.setErrorHandler(errorHandler);
            reader.read(xmlFile);
            if (writer == null) {
                writer = new XMLWriter(OutputFormat.createPrettyPrint());
            }
            if (errorHandler.getErrors().hasContent()) {
                writer.write(errorHandler.getErrors());
                return false;
            } else {
                return true;
            }
        } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.