Package org.jdom2.input

Examples of org.jdom2.input.SAXBuilder.build()


   */
  private void openLangFile()
  {
    SAXBuilder sxb = new SAXBuilder();
    try {
      this.root = sxb.build(new File(Language.xmlPath)).getRootElement();
      this.openLocaleLang();
    } catch (JDOMException | IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here


        System.out.println("-----------Checking file: "+file.getName()+ " "+String.valueOf(x)+"/"+String.valueOf(files.size())+"--------------");
        x++;
        try
        {
          SAXBuilder builder=new SAXBuilder();
          Document xml=(Document)builder.build(file);
          ArrayList<Element> words=new ArrayList<Element>();
          for(Element word:xml.getDescendants(new ElementFilter("wf")))
            words.add(word);
          for(int w=0;w<words.size();w++)
          {
View Full Code Here

     * @throws IOException
     */
    private Element htmlStringToElement( String html ) throws JDOMException, IOException
    {
        SAXBuilder builder = new SAXBuilder( CYBERNEKO_PARSER, true );
        Document doc = builder.build( new StringReader( html ) );
        Element element = doc.getRootElement();
        return element;
    }

    /**
 
View Full Code Here

        Enumeration< URL > resources = XmlUtil.class.getClassLoader().getResources( xml );
        while( resources.hasMoreElements() ) {
                  URL resource = resources.nextElement();
                 
                  log.debug( "reading " + resource.toString() );
                  Document doc = builder.build( resource );
                  XPathFactory xpfac = XPathFactory.instance();
                  XPathExpression< Element > xp = xpfac.compile( requestedNodes, Filters.element() );
                  readed.addAll( xp.evaluate( doc ) ); // filter out repeated items
              }
        return new ArrayList< Element >( readed );
View Full Code Here

   */
  public static List< Element > parse( InputStream xmlStream, String requestedNodes ) {
    if( xmlStream != null && StringUtils.isNotEmpty( requestedNodes ) ) {
      SAXBuilder builder = new SAXBuilder();
      try {
                Document doc = builder.build( xmlStream );
                XPathFactory xpfac = XPathFactory.instance();
                XPathExpression< Element > xp = xpfac.compile( requestedNodes, Filters.element() );
               
        return xp.evaluate( doc );
      } catch ( IOException ioe ) {
View Full Code Here

        }
        if( url == null )
            throw new IOException("Unable to find web.xml for processing.");

        log.debug( "Processing web.xml at " + url.toExternalForm() );
        doc = builder.build( url );
        return doc;
    }

    /**
     * <p>XML entity resolver that redirects resolution requests by JDOM, JAXP and
View Full Code Here

          String versionOverride = System.getProperty("version.override");
            if (versionOverride != null) {
                getLog().info("changing version of pom file and save it to target/pom.xml");
                SAXBuilder builder = new SAXBuilder();
                Document doc = builder.build(pomFile);
                Element versionElem = findElement(doc.getRootElement().getChildren(), "version");
                if (versionElem == null) {
                 
                  //version inherited from parent, so get it from there
                  Element parentElem = findElement(doc.getRootElement().getChildren(), "parent");
View Full Code Here

  public Element importarArquivoXML(){
    Document doc = null;
        SAXBuilder builder = new SAXBuilder();
        try {

              doc = builder.build(path);

        } catch (Exception e) {
         
              e.printStackTrace();
View Full Code Here

           
            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

                String cleanScmUrl = "not defined";
                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", getNamespaceOrNull(root));

                    if(null != scmElement)
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.