Examples of SAXBuilder


Examples of org.jdom.input.SAXBuilder

  static private org.jdom.Document getCapabilities(String endpoint) throws IOException {
    org.jdom.Document doc;
    InputStream in = null;
    try {
      in = CdmRemote.sendQuery(endpoint, "req=capabilities");
      SAXBuilder builder = new SAXBuilder(false);
      doc = builder.build(in);

    } catch (Throwable t) {
      throw new IOException(t);

    } finally {
View Full Code Here

Examples of org.jdom.input.SAXBuilder

     */
    static public TDSRadarDatasetCollection factory(String desc,
            String dsc_location, StringBuffer errlog)
            throws IOException {
        // super();
        SAXBuilder        builder;
        Document          doc  = null;
        XMLEntityResolver jaxp = new XMLEntityResolver(true);
        builder = jaxp.getSAXBuilder();

        try {
            doc = builder.build(dsc_location);
        } catch (JDOMException e) {
            errlog.append(e.toString());
        }

        Element   qcElem = doc.getRootElement();
View Full Code Here

Examples of org.jdom.input.SAXBuilder

     *
     * @throws IOException _more_
     */
    public HashMap<String,Station> readRadarStations(String stsXML_location)
            throws IOException {
        SAXBuilder        builder;
        Document          doc  = null;
        XMLEntityResolver jaxp = new XMLEntityResolver(true);
        builder = jaxp.getSAXBuilder();
        HashMap<String,Station> stations = new HashMap<String,Station>();

        try {
            doc = builder.build(stsXML_location);
        } catch (JDOMException e) {
            e.printStackTrace();
        }

        Element       rootElem = doc.getRootElement();
View Full Code Here

Examples of org.jdom.input.SAXBuilder

  }

  public boolean populate(InputStream ncml, NetcdfFile target) throws IOException {
    org.jdom.Document doc;
    try {
      SAXBuilder builder = new SAXBuilder(validate);
      doc = builder.build(ncml);
    } catch (JDOMException e) {
      throw new IOException(e.getMessage());
    }
    if (showParsedXML) {
      XMLOutputter xmlOut = new XMLOutputter();
View Full Code Here

Examples of org.jdom.input.SAXBuilder

    // if (debug) System.out.println(" read from XML " + xmlLocation);

    InputStream is = new BufferedInputStream(new ByteArrayInputStream(xmlString));
    org.jdom.Document doc;
    try {
      SAXBuilder builder = new SAXBuilder();
      doc = builder.build(is);
    } catch (JDOMException e) {
      throw new IOException(e.getMessage() + " reading from XML ");
    }

    Element rootElem = doc.getRootElement();
View Full Code Here

Examples of org.jdom.input.SAXBuilder

        InputStream in = new BufferedInputStream(
                new FileInputStream(_testDataPath + "/server/" + TEST_DATA_FILE));

        assertNotNull("XML data file could not be loaded: " + TEST_DATA_FILE, in);

        SAXBuilder saxBuilder = new SAXBuilder();
        Document document = saxBuilder.build(in);
        Element testSuite = document.getRootElement();
        List tests = testSuite.getChildren("test");
        for (int i = 0; i < tests.size(); i++)
        {
            Element test = (Element) tests.get(i);
View Full Code Here

Examples of org.jdom.input.SAXBuilder

  {
   
    // read the registry
    try
    {
      SAXBuilder saxBuilder = new SAXBuilder();
      Document document = saxBuilder.build(reader);
     
      // read all the data from the document and place into data structures.
      loadDocument(document);
    }
    catch (JDOMException e)
View Full Code Here

Examples of org.jdom.input.SAXBuilder

   * @see org.rssowl.core.interpreter.ISAXParser#parse(java.io.InputStream)
   */
  public Document parse(InputStream inS) throws ParserException {
    Document document = null;
    Exception ex = null;
    SAXBuilder builder = getBuilder();

    /* Set a Mark to support a 2d Run */
    KeepAliveInputStream keepAliveIns = new KeepAliveInputStream(inS);
    keepAliveIns.mark(0);

    /* First Run - Try with Documents own Encoding */
    try {
      document = builder.build(keepAliveIns);
    } catch (JDOMException e) {
      ex = e;
    } catch (IOException e) {
      ex = e;
    }

    /* Second Run - Try with Platform Default Encoding */
    if (ex instanceof JDOMParseException) {

      /* Try to reset the Stream to 0 */
      boolean reset = false;
      try {
        keepAliveIns.reset();
        reset = true;
      } catch (IOException e) {
        /* Reset Failed, do not override previous exception */
      }

      /* In case reset-operation was successfull */
      if (reset) {
        try {
          document = builder.build(new InputStreamReader(keepAliveIns));
        } catch (JDOMException e) {
          ex = e;
        } catch (IOException e) {
          ex = e;
        }
View Full Code Here

Examples of org.jdom.input.SAXBuilder

    /* Return Document */
    return document;
  }

  private SAXBuilder getBuilder() {
    SAXBuilder builder = new SAXBuilder();

    /* Support Java Encoding Names */
    builder.setFeature(ALLOW_JAVA_ENCODINGS, true);

    /* Custom Entitiy Resolution */
    builder.setEntityResolver(new EntityResolver2() {

      /*
       * @see org.xml.sax.ext.EntityResolver2#getExternalSubset(java.lang.String,
       * java.lang.String)
       */
 
View Full Code Here

Examples of org.jdom.input.SAXBuilder

     * @param configFile
     */
    private ConfigReader(File configFile){
        try{
            lastModified = configFile.lastModified();
            config = new SAXBuilder().build(configFile);
        }catch(JDOMException jdEx){
            logger.log(Level.SEVERE, "Error reading config file " +
                    DEFAULT_CONFIG_FILE_NAME);
            throw new RuntimeException(jdEx);
        }
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.