Package org.jdom2.input

Examples of org.jdom2.input.SAXBuilder


            String content = ReleaseUtil.readXmlFile(pomFile, ls);
            // we need to eliminate any extra whitespace inside elements, as JDOM will nuke it
            content = content.replaceAll( "<([^!][^>]*?)\\s{2,}([^>]*?)>", "<$1 $2>" );
            content = content.replaceAll( "(\\s{2,}|[^\\s])/>", "$1 />" );

            SAXBuilder builder = new SAXBuilder();
            Document document = builder.build( new StringReader( content ) );

            // Normalize line endings to platform's style (XML processors like JDOM normalize line endings to "\n" as
            // per section 2.11 of the XML spec)
            normaliseLineEndings( document );

View Full Code Here


  }

  private Element getRootElement(InputStream configFile) throws Exception {
    File xsd = new File(getClass().getResource(INITIALIZER_METADATA_XSD).toURI());
    XMLReaderXSDFactory xsdFactory = new XMLReaderXSDFactory(xsd);
    SAXBuilder builder = new SAXBuilder(xsdFactory);
    Element root = builder.build(configFile).getRootElement();
    return root;
  }
View Full Code Here

  @Override
  public Map<String, List<Object>> read(InputStream input, boolean autoClose) throws Exception {
    Validate.notNull(input);

    try {
      SAXBuilder builder = new SAXBuilder();
      Element root = builder.build(input).getRootElement();
      return read(root);
    } finally {
      if (autoClose) {
        input.close();
      }
View Full Code Here

  }

  public Document getDoc(InputStream is) {
    try {
      if (doc == null)
        doc = new SAXBuilder().build(is);
      else
        return doc;
    } catch (JDOMException e) {
      e.printStackTrace();
    } catch (IOException e) {
View Full Code Here

      get.setQueryString(query);
           
            httpclient.executeMethod(get);
           
            final String xml = get.getResponseBodyAsString();
            final SAXBuilder builder = new SAXBuilder();
            Document doc = builder.build(new StringReader(xml));
            Element root = doc.getRootElement();
            String lat = root.getChild("result").getChild("geometry").getChild("location").getChildTextTrim("lat");
            String lon = root.getChild("result").getChild("geometry").getChild("location").getChildTextTrim("lng");
            return Location.fromString(lat + ";" + lon);
        } catch (Exception ex) {
View Full Code Here

        return attribute.getValue();
    }

    public static org.jdom2.Document loadInput(String html) throws LoadInputException {
        try {
            return new SAXBuilder().build(new StringReader(html));
        } catch (JDOMException e) {
            throw new LoadInputException("Unable to parse input", e);
        } catch (IOException e) {
            throw new LoadInputException("Unable to parse input", e);
        }
View Full Code Here

                }

                try
                {
                    String content = ReleaseUtil.readXmlFile(pomFile, ls);
                    SAXBuilder builder = new SAXBuilder();
                    Document document = builder.build(new StringReader( content ));
                    Element root = document.getRootElement();

                    Element scmElement = root.getChild("scm", root.getNamespace());

                    if(null != scmElement)
View Full Code Here

    }

    private LinkedList<String> doFilter(String in, Set<String> xpaths) throws IOException {
        LinkedList<String> result = new LinkedList<String>();
        try {
            Document doc = new SAXBuilder(XMLReaders.NONVALIDATING).build(new StringReader(in));
            XMLOutputter out = new XMLOutputter();

            for (String xp : xpaths) {
                XPathExpression<Content> xpath = XPathFactory.instance().compile(xp, Filters.content());
                for (Content node : xpath.evaluate(doc)) {
View Full Code Here

      params.put("prefix", "maps/");

      for (;;)
      {
        String url = String.format("%s?%s", repo, QueryUtil.prepareParams(params));
        Element listing = new SAXBuilder().build(new URL(url)).getRootElement();
        assert "ListBucketResult".equals(listing.getName()) : "Unexpected response";
        Namespace ns = listing.getNamespace();

        String lastkey = null;
        for (Element entry : listing.getChildren("Contents", ns))
View Full Code Here

      // if it doesn't have an autoreferee config file
      while (entries.hasMoreElements())
      {
        ZipEntry entry = entries.nextElement();
        if (entry.getName().endsWith(AutoReferee.CFG_FILENAME))
          return new SAXBuilder().build(zfile.getInputStream(entry)).getRootElement();
      }
    }
    catch (Exception e)
    {
      // if the zip file is malformed in some way, tell which file caused the problem
View Full Code Here

TOP

Related Classes of org.jdom2.input.SAXBuilder

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.