Package org.apache.oodt.commons.util

Examples of org.apache.oodt.commons.util.DOMParser


    // It wasn't in the cache, so create a parser to parse the file.  We only
    // deal with correct files, so turn on validation and install an error
    // handler that will throw an exception.
    profiles = new ArrayList();
    DOMParser parser = XML.createDOMParser();
    parser.setErrorHandler(new ErrorHandler() {
      public void error(SAXParseException ex) throws SAXParseException {
        System.err.println("Parse error line " + ex.getLineNumber() + " column "
          + ex.getColumnNumber() + ": " + ex.getMessage());
        throw ex;
      }
      public void warning(SAXParseException ex) {
        System.err.println("Parse warning: " + ex.getMessage());
      }
      public void fatalError(SAXParseException ex) throws SAXParseException {
        throw ex;
      }
    });

    // Parse the file.
    InputSource inputSource = new InputSource(url.toString());
    parser.parse(inputSource);
    Document doc = parser.getDocument();

    // Normalize it and get the document element, and from that, create a list
    // of profiles, and add it to the cache.
    doc.normalize();
    Element root = doc.getDocumentElement();
View Full Code Here

TOP

Related Classes of org.apache.oodt.commons.util.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.