Package org.apache.xerces.parsers

Examples of org.apache.xerces.parsers.DOMParser


            fCurrentSchemaInfo = (SchemaInfo)(fRedefineLocations.get((Object)location));
            fCurrentSchemaInfo.restore();
            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);
        }catchorg.xml.sax.SAXNotRecognizedException e ) {
            e.printStackTrace();
        }catch( org.xml.sax.SAXNotSupportedException e ) {
            e.printStackTrace();
        }

        try {
            parser.parse( source );
        }catch( IOException e ) {
            e.printStackTrace();
        }catch( SAXException e ) {
            //e.printStackTrace();
        }

        Document     document   = parser.getDocument(); //Our Grammar to be redefined
        Element root = null;
        if (document != null) {
            root = document.getDocumentElement();
        }
View Full Code Here


         if (importedGrammar == null) {
             importedGrammar = new SchemaGrammar();
         }

         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);
         }catchorg.xml.sax.SAXNotRecognizedException e ) {
             e.printStackTrace();
         }catch( org.xml.sax.SAXNotSupportedException e ) {
             e.printStackTrace();
         }

         try {
             parser.parse( source );
         }catch( IOException e ) {
             e.printStackTrace();
         }catch( SAXException e ) {
             e.printStackTrace();
         }

         Document     document   = parser.getDocument(); //Our Grammar
         Element root = null;
         if (document != null) {
             root = document.getDocumentElement();
         }
View Full Code Here

    /**
      Creates a Document from the root element of the XML Stream.
    */
    public Document createDOM()
    {
        DOMParser parser = null;
        Document doc = null;

        try
        {
            outStream.close(); // before we parse the InputStream make sure the pipe is closed.
            parser = new DOMParser();
            parser.parse(new org.xml.sax.InputSource(pis));
            doc = parser.getDocument();
        }
        catch(java.io.IOException ioe)
        {
            System.err.println(ioe.toString());
            ioe.printStackTrace();
View Full Code Here

          if (fSchemaGrammarParser == null) {
              //
              // creating a parser for schema only once per parser instance
              // leads to less objects, but increases time we spend in reset()
              //
              fSchemaGrammarParser = new DOMParser();
              fSchemaGrammarParser.setEntityResolver( new Resolver(fEntityHandler) );
              fSchemaGrammarParser.setErrorHandlernew ErrorHandler() );

              try {
                fSchemaGrammarParser.setFeature("http://xml.org/sax/features/validation", false);
View Full Code Here

        if (fIncludeLocations.contains((Object)location)) {
            return;
        }
        fIncludeLocations.addElement((Object)location);

        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);
        }catchorg.xml.sax.SAXNotRecognizedException e ) {
            e.printStackTrace();
        }catch( org.xml.sax.SAXNotSupportedException e ) {
            e.printStackTrace();
        }

        try {
            parser.parse( source );
        }catch( IOException e ) {
            e.printStackTrace();
        }catch( SAXException e ) {
            //e.printStackTrace();
        }

        Document     document   = parser.getDocument(); //Our Grammar
        Element root = null;
        if (document != null) {
            root = document.getDocumentElement();
        }
View Full Code Here

     * @return DOCUMENT ME!
     *
     * @throws Exception DOCUMENT ME!
     */
    public Document getDocument(String filename) throws Exception {
        DOMParser parser = new DOMParser();

        org.xml.sax.InputSource in = new org.xml.sax.InputSource(filename);
        parser.parse(in);

        return parser.getDocument();
    }
View Full Code Here

     * @return DOCUMENT ME!
     *
     * @throws Exception DOCUMENT ME!
     */
    public Document getDocument(InputStream is) throws Exception {
        DOMParser parser = new DOMParser();
        org.xml.sax.InputSource in = new org.xml.sax.InputSource(is);
        parser.parse(in);

        return parser.getDocument();
    }
View Full Code Here

     * @return DOCUMENT ME!
     *
     * @throws Exception DOCUMENT ME!
     */
    public Document getDocument(Reader reader) throws Exception {
        DOMParser parser = new DOMParser();
        org.xml.sax.InputSource in = new org.xml.sax.InputSource(reader);
        parser.parse(in);

        return parser.getDocument();
    }
View Full Code Here

   private void resolveSchemaGrammar( String loc, String uri) throws Exception {

      SchemaGrammar grammar = (SchemaGrammar) fGrammarResolver.getGrammar(uri);

      if (grammar == null) {
         DOMParser parser = new DOMParser();
         parser.setEntityResolver( new Resolver(fEntityHandler) );
         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);
         } catch org.xml.sax.SAXNotRecognizedException e ) {
            e.printStackTrace();
         } catch ( org.xml.sax.SAXNotSupportedException e ) {
            e.printStackTrace();
         }

         // expand it before passing it to the parser
         InputSource source = null;
         EntityResolver currentER = parser.getEntityResolver();
         if (currentER != null) {
            source = currentER.resolveEntity("", loc);
         }
         if (source == null) {
            loc = fEntityHandler.expandSystemId(loc);
            source = new InputSource(loc);
         }
         try {
            parser.parse( source );
         } catch ( IOException e ) {
            e.printStackTrace();
         } catch ( SAXException e ) {
            //System.out.println("loc = "+loc);
            //e.printStackTrace();
            reportRecoverableXMLError( XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                       XMLMessages.SCHEMA_GENERIC_ERROR, e.getMessage() );
         }

         Document     document   = parser.getDocument(); //Our Grammar

         TraverseSchema tst = null;
         try {
            if (DEBUG_SCHEMA_VALIDATION) {
               System.out.println("I am geting the Schema Document");
View Full Code Here

        if (fIncludeLocations.contains((Object)location)) {
            return;
        }
        fIncludeLocations.addElement((Object)location);

        DOMParser parser = new DOMParser() {
            public void ignorableWhitespace(char ch[], int start, int length) {}
            public void ignorableWhitespace(int dataIdx) {}
        };
        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);
        }catchorg.xml.sax.SAXNotRecognizedException e ) {
            e.printStackTrace();
        }catch( org.xml.sax.SAXNotSupportedException e ) {
            e.printStackTrace();
        }

        try {
            parser.parse( source );
        }catch( IOException e ) {
            e.printStackTrace();
        }catch( SAXException e ) {
            //e.printStackTrace();
        }

        Document     document   = parser.getDocument(); //Our Grammar
        Element root = null;
        if (document != null) {
            root = document.getDocumentElement();
        }
View Full Code Here

TOP

Related Classes of org.apache.xerces.parsers.DOMParser

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.