Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element


        String content = asciidoctor.renderFile(new File("target/test-classes/sample-with-man-link.ad"), options()
                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element link = doc.getElementsByTag("a").first();
        assertNotNull(link);
        assertThat(link.attr("href"), is("gittutorial.html"));

    }
View Full Code Here


        String content = asciidoctor.renderFile(new File("target/test-classes/sample-with-man-link.ad"), options()
                .toFile(false).get());

        Document doc = Jsoup.parse(content, "UTF-8");
        Element link = doc.getElementsByTag("a").first();
        assertNotNull(link);
        assertThat(link.attr("href"), is("gittutorial.html"));

    }
View Full Code Here

        asciidoctor.renderFile(new File("target/test-classes/rendersample.asciidoc"), options);

        File renderedFile = new File(testFolder.getRoot(), "rendersample.html");
        Document doc = Jsoup.parse(renderedFile, "UTF-8");

        Element footer = doc.getElementById("footer-text");
        assertThat(footer.text(), not(containsString("Copyright Acme, Inc.")));
    }
View Full Code Here

        String copyright  = "Copyright Acme, Inc.";
       
        if(document.basebackend("html")) {
            org.jsoup.nodes.Document doc = Jsoup.parse(output, "UTF-8");

            Element contentElement = doc.getElementById("footer-text");
            contentElement.append(copyright);
           
            output = doc.html();
           
        }
View Full Code Here

                "target/test-classes/arrows-and-boxes-example.ad"), options);

        File renderedFile = new File(testFolder.getRoot(), "rendersample.html");
        Document doc = Jsoup.parse(renderedFile, "UTF-8");
       
        Element arrowsJs = doc.select("script[src=http://www.headjump.de/javascripts/arrowsandboxes.js").first();
        assertThat(arrowsJs, is(notNullValue()));
       
        Element arrowsCss = doc.select("link[href=http://www.headjump.de/stylesheets/arrowsandboxes.css").first();
        assertThat(arrowsCss, is(notNullValue()));
       
        Element arrowsAndBoxes = doc.select("pre[class=arrows-and-boxes").first();
        assertThat(arrowsAndBoxes, is(notNullValue()));
       
    }
View Full Code Here

        } else {
            try {
                Elements elements = doc.select("div.mw-content-ltr > p");

                if (elements.size() > 0) {
                    Element p = elements.first();
                    String summary = p.text();

                    channel.write(url.toString());
                    channel.writeMultiple(BotAppletUtil.blockFormat(summary, 400, 10));
                } else {
                    channel.write("Can not get article summary");
View Full Code Here

        } else {
            try {
                Elements elements = doc.select("div.definition");

                if (elements.size() > definitionIndex) {
                    Element def = elements.get(definitionIndex);
                    String definition = this.textWithBreaks(def);
                    String[] lines = definition.split("\n");
                    String longestLine = lines[0];
                    String response;
View Full Code Here

        } catch (IOException e) {
            channel.write("Error");
            return;
        }

        Element div = doc.select("div.post-content").first();
        Element title = div.getElementsByTag("a").first();
        channel.write(title.text());
        Element content = div.getElementsByTag("pre").first();
        channel.writeMultiple(content.text().replaceAll("\t", "").split("\n"));
    }
View Full Code Here

        return render;
    }

    private Element makeShowHtml(String file, String title, String contents) {
        // create the pre tag
        Element pre = new Element(Tag.valueOf("pre"), "");
        pre.addClass("prettyprint source");
        pre.attr("style", "overflow-x:auto");
        List<Node> preChildren = new ArrayList<>();
        if (contents != null) {
            preChildren.add(new Element(Tag.valueOf("span"), "").appendText(contents));
        }
        ElementUtil.appendNodes(pre, preChildren);

        // create the article tag
        Element article = new Element(Tag.valueOf("article"), "");
        List<Node> articleChildren = new ArrayList<>();
        if (title == null) {
            if (file != null) {
                articleChildren.add(new Element(Tag.valueOf("div"), "").appendText(file));
            }
        } else {
            articleChildren.add(new Element(Tag.valueOf("div"), "").appendText(title));
        }
        articleChildren.add(pre);
        ElementUtil.appendNodes(article, articleChildren);

        // create the section tag
        Element section = new Element(Tag.valueOf("section"), "");
        List<Node> sectionChildren = new ArrayList<>();
        sectionChildren.add(article);
        ElementUtil.appendNodes(section, sectionChildren);

        return section;
View Full Code Here

      return new FiiEmissaoPojo(this);
    }

    @Override
    public LocalDate getData() {
      Element span;
      span = div.getElementById("ctl00_contentPlaceHolderConteudo_ucFundoDetalhes_lblDataCota");

      String data = span.text();
      return forPattern("dd/MM/yyyy").parseLocalDate(data);
    }
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Element

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.