Package org.xml.sax

Examples of org.xml.sax.ErrorHandler


     * @throws SAXException
     */
    protected void checkValidationErrors(Document dom, Schema schema) throws SAXException, IOException {
        final Validator validator = schema.newValidator();
        final List<Exception> validationErrors = new ArrayList<Exception>();
        validator.setErrorHandler(new ErrorHandler() {
           
            public void warning(SAXParseException exception) throws SAXException {
                System.out.println(exception.getMessage());
            }

View Full Code Here


                builder = factory.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new Error(e);
            }
           
            builder.setErrorHandler(new ErrorHandler() {
                public void warning(SAXParseException e) throws SAXException {
                    throw e;
                }

                public void error(SAXParseException e) throws SAXException {
View Full Code Here

        // No dtd handler, so any dtd events will be ignored, which is fine
        // since we do not expect to get any for XML "fragments".
        // Use the DOM parsers nodeValue handler.
        saxParser.setContentHandler(domParser);
        // Use a specific error handler since we have specific needs here.
        saxParser.setErrorHandler(new ErrorHandler() {
            public void warning(SAXParseException e) {
                // Log and continue.
                logger.warn("parsing-problem", new Object[]{DOMScript.this},
                        adjust(e));
            }
View Full Code Here

            return null;
        }
    }

    protected Document parse(File artifact) throws Exception {
        return XmlUtils.parse(artifact, new ErrorHandler() {
            public void warning(SAXParseException exception) throws SAXException {
            }

            public void error(SAXParseException exception) throws SAXException {
            }
View Full Code Here

        if (dbf == null) {
            dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
        }
        DocumentBuilder db = dbf.newDocumentBuilder();
        db.setErrorHandler(new ErrorHandler() {
            public void warning(SAXParseException exception) throws SAXException {
            }
            public void error(SAXParseException exception) throws SAXException {
            }
            public void fatalError(SAXParseException exception) throws SAXException {
View Full Code Here

        return factory;
    }

    protected static ErrorHandler getErrorHandler() {
        @SuppressWarnings("static-access")
        ErrorHandler handler = implHelper.getRegisteredErrorHandler();
        if (handler == null) {
            handler = getDefaultErrorHandler();
        }
        return handler;
View Full Code Here

        }
        return handler;
    }
   
    protected static ErrorHandler getDefaultErrorHandler() {
        return new ErrorHandler() {
                public void error(SAXParseException exception)
                        throws SAXException {
                    throw exception;
                }
View Full Code Here

        }
        fIncludeLocations.addElement((Object)location);

        DOMParser parser = new IgnoreWhitespaceParser();
        parser.setEntityResolver( new Resolver() );
        parser.setErrorHandlernew ErrorHandler()
            {
                public void fatalError(SAXParseException ex) throws SAXException {
                    StringBuffer str = new StringBuffer();
                    String systemId_ = ex.getSystemId();
                    if (systemId_ != null) {
View Full Code Here

            return;
        }

        DOMParser parser = new IgnoreWhitespaceParser();
        parser.setEntityResolver( new Resolver() );
        parser.setErrorHandlernew ErrorHandler() );

        try {
            parser.setFeature("http://xml.org/sax/features/validation", false);
            parser.setFeature("http://xml.org/sax/features/namespaces", true);
            parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
View Full Code Here

             return;
         }

         DOMParser parser = new IgnoreWhitespaceParser();
         parser.setEntityResolver( new Resolver() );
         parser.setErrorHandlernew ErrorHandler()
            {
                public void fatalError(SAXParseException ex) throws SAXException {
                    StringBuffer str = new StringBuffer();
                    String systemId_ = ex.getSystemId();
                    if (systemId_ != null) {
View Full Code Here

TOP

Related Classes of org.xml.sax.ErrorHandler

Copyright © 2018 www.massapicom. 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.