Examples of DOMParser


Examples of org.apache.xerces.parsers.DOMParser

    }

    /** Set up the Server with the given configuration file. */
    public static void readConfig(Server inServer, String inFileName) throws Exception {
        // read the XML document
        DOMParser parser = new DOMParser();
        parser.parse(inFileName);
        Document tempDocument= parser.getDocument();
        Element tempRootElement = tempDocument.getDocumentElement();
        if (tempRootElement.getTagName().equals("GISToolkit")){
            gistoolkit.common.Node tempNode = getNode(tempRootElement);
            gistoolkit.common.Node tempServerNode = tempNode.getChild("GISServer");
            inServer.setNode(tempServerNode);
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    }

    /** Reads configuration information from the given file. */
    public static gistoolkit.common.Node readConfig( String inFileName) throws Exception {
        // read the XML document
        DOMParser parser = new DOMParser();
        parser.parse(inFileName);
        Document tempDocument= parser.getDocument();
        Element tempRootElement = tempDocument.getDocumentElement();
        if (tempRootElement.getTagName().equals("GISToolkit")){
            gistoolkit.common.Node tempNode = getNode(tempRootElement);
            gistoolkit.common.Node[] tempNodes = tempNode.getChildren();
            if (tempNodes.length > 0){
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    }
   
    /** Read an XML document from the given location, and parse it into a node tree */
    public static gistoolkit.common.Node getXML(String inLocation) throws Exception{
        // read the XML document
        DOMParser parser = new DOMParser();
        parser.setFeature("http://xml.org/sax/features/validation", false);
        parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
        parser.parse(inLocation);
        Document tempDocument= parser.getDocument();
        Element tempRootElement = tempDocument.getDocumentElement();
        gistoolkit.common.Node tempNode = getNode(tempRootElement);
        return tempNode;
    }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    }
    else
    {
      Document document = null;
      try {     
        DOMParser parser = new DOMParser();
        parser.parse(new InputSource(new ByteArrayInputStream(content.getBytes())));
        document = parser.getDocument();     
      } catch (Throwable e) {
        XcapException e1 = new XcapException("Unable to read XML content",
            HttpServletResponse.SC_CONFLICT, e);
        StringBuffer sb = new StringBuffer();
        sb.append(XcapException.XCAP_ERROR_HEADER);
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    {
      if (_document == null)
      {
        try
        {
          DOMParser parser = new DOMParser();
          parser.parse(new InputSource(new FileInputStream(_file)));
          _document = parser.getDocument();
        }
        catch (Exception e)
        {
          throw XcapException.newInternalError(e);
        }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    {
        Html2Ecs html2ecs = new Html2Ecs();
        try
        {
            input = new FileInputStream( args[0] );
            parser = new DOMParser();
            parser.parse(new InputSource(input));
            doc = parser.getDocument();
        }
        catch(SAXException se)
        {
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

   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

Examples of org.apache.xerces.parsers.DOMParser

     * Create a new <code>SAXParserFactoryImpl</code> instance.
     */
    protected DocumentBuilderImpl(boolean namespaces, boolean validation)
    throws ParserConfigurationException {
        this();
        DOMParser p=new DOMParser();
        try {
            p.setFeature("http://xml.org/sax/features/namespaces",namespaces);
        } catch (SAXException e) {
            throw new ParserConfigurationException("Cannot set namespace "+
                "awareness to "+namespaces);
        }
        try {
            p.setFeature("http://xml.org/sax/features/validation",validation);
        } catch (SAXException e) {
            throw new ParserConfigurationException("Cannot set validation to "+
                validation);
        }
        this.namespaces=namespaces;
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

        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

Examples of org.apache.xerces.parsers.DOMParser

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

         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
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.