Package org.xml.sax

Examples of org.xml.sax.ErrorHandler


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


    Document doc = null;

    try {
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      db.setErrorHandler(new ErrorHandler() {

        @Override
        public void warning(SAXParseException exception) throws SAXException {
          logger.warn("Sitemap XML warning: " + exception.getMessage());
        }
View Full Code Here

      @Override
      public void setDocumentLocator(Locator locator) {}
      @Override
      public void skippedEntity(String name) throws SAXException {}
    });
    xr.setErrorHandler(new ErrorHandler() {
      @Override
      public void error(SAXParseException arg0) throws SAXException {
        arg0.printStackTrace();
      }
View Full Code Here

      public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {}
      public void processingInstruction(String target, String data) throws SAXException { }
      public void setDocumentLocator(Locator locator) {}
      public void skippedEntity(String name) throws SAXException {}
    });
    xr.setErrorHandler(new ErrorHandler() {
      public void error(SAXParseException arg0) throws SAXException {
        arg0.printStackTrace();
      }
     
      public void fatalError(SAXParseException arg0) throws SAXException {
View Full Code Here

        return factory;
    }

    protected static ErrorHandler getErrorHandler() {
        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

                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

        }
       
        // These validation errors are just warnings for us as we want to support
        // running from an XML document with XSD validation errors, as long as we can
        // get the metadata we need from the document
        handler.setErrorHandler(new ErrorHandler() {         
            private String getMessage(SAXParseException e) {
                return "XMLSchema validation problem in: " + getArtifactName( e.getSystemId() ) + ", line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + "\n" + e.getMessage();
            }
           
            public void error(SAXParseException exception) throws SAXException {             
View Full Code Here

        }
       
        // These validation errors are just warnings for us as we want to support
        // running from an XML document with XSD validation errors, as long as we can
        // get the metadata we need from the document
        handler.setErrorHandler(new ErrorHandler() {
            private String getMessage(SAXParseException e) {
                return "XMLSchema validation problem in: " + e.getSystemId() + ", line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + "\n" + e.getMessage();
            }
           
            public void error(SAXParseException exception) throws SAXException {
View Full Code Here

        //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
        //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", SchemaUrl);
        DocumentBuilder builder = factory.newDocumentBuilder();
        if (validate) {
            LocalResolver lr = new LocalResolver(new DefaultHandler());
            ErrorHandler eh = new LocalErrorHandler(docDescription, lr);

            builder.setEntityResolver(lr);
            builder.setErrorHandler(eh);
        }
        document = builder.parse(is);
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.