Package org.jsoup.nodes

Examples of org.jsoup.nodes.Document.html()


                            .ignoreContentType()
                            .response();
        cookies = resp.cookies();

        Document doc = resp.parse();
        if (doc.html().contains("profile is private")) {
            sendUpdate(STATUS.RIP_ERRORED, "User has private profile");
            throw new IOException("User has private profile");
        }
        return doc;
    }
View Full Code Here


    public String toHtml() {
        Document doc = new Document("");
        doc.appendChild(toElement());
        RenderUtil.applyMessages(doc);
        RenderUtil.applyClearAction(doc, true);
        return doc.html();
    }

    public String toString() {
        return toHtml();
    }
View Full Code Here

        saveLinFromMovie(elem, outFile);
        m_cLins += 1;
        Writer w = new OutputStreamWriter(new FileOutputStream(sLocalFile),
          docLocal.outputSettings().charset());
        try {
          w.write(docLocal.html());
        }
        finally {
          w.close();
        }
      } catch (IOException ioe) {
View Full Code Here

        Document doc = Jsoup.parse(content);

        handleLinks(doc);
        handleImages(doc);

        return doc.html();
    }

    private static String getRenderedHTMLWithTemplate(Lang lang, String message, String urlToView, Resource resource){
        return views.html.common.notificationMail.render(lang, message, urlToView, resource).toString();
    }
View Full Code Here

        try {
          Document doc = Jsoup.parse(new ByteArrayInputStream(response.content), null, url);

          if (htmlMapping == null) {
            return doc.html();
          } else {
            Map<String, String> ret = new HashMap<>();
            for (String dataField : htmlMapping.keySet()) {
              String value = null;
              Map<String, Object> fieldMappingConfig = htmlMapping.get(dataField);
View Full Code Here

                }
              } else {
                if (stripHtml) {
                  value = convertNodeToText(doc);
                } else {
                  value = doc.html();
                }
              }
              ret.put(dataField, value);
            }
            return ret;
View Full Code Here

    public void testSimpleXmlParse() {
        String xml = "<doc id=2 href='/bar'>Foo <br /><link>One</link><link>Two</link></doc>";
        XmlTreeBuilder tb = new XmlTreeBuilder();
        Document doc = tb.parse(xml, "http://foo.com/");
        assertEquals("<doc id=\"2\" href=\"/bar\">Foo <br /><link>One</link><link>Two</link></doc>",
                TextUtil.stripNewlines(doc.html()));
        assertEquals(doc.getElementById("2").absUrl("href"), "http://foo.com/bar");
    }

    @Test
    public void testPopToClose() {
View Full Code Here

        // test: </val> closes Two, </bar> ignored
        String xml = "<doc><val>One<val>Two</val></bar>Three</doc>";
        XmlTreeBuilder tb = new XmlTreeBuilder();
        Document doc = tb.parse(xml, "http://foo.com/");
        assertEquals("<doc><val>One<val>Two</val>Three</val></doc>",
                TextUtil.stripNewlines(doc.html()));
    }

    @Test
    public void testCommentAndDocType() {
        String xml = "<!DOCTYPE html><!-- a comment -->One <qux />Two";
View Full Code Here

    public void testCommentAndDocType() {
        String xml = "<!DOCTYPE html><!-- a comment -->One <qux />Two";
        XmlTreeBuilder tb = new XmlTreeBuilder();
        Document doc = tb.parse(xml, "http://foo.com/");
        assertEquals("<!DOCTYPE html><!-- a comment -->One <qux />Two",
                TextUtil.stripNewlines(doc.html()));
    }

    @Test
    public void testSupplyParserToJsoupClass() {
        String xml = "<doc><val>One<val>Two</val></bar>Three</doc>";
View Full Code Here

    @Test
    public void testSupplyParserToJsoupClass() {
        String xml = "<doc><val>One<val>Two</val></bar>Three</doc>";
        Document doc = Jsoup.parse(xml, "http://foo.com/", Parser.xmlParser());
        assertEquals("<doc><val>One<val>Two</val>Three</val></doc>",
                TextUtil.stripNewlines(doc.html()));
    }

    @Ignore
    @Test
    public void testSupplyParserToConnection() throws IOException {
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.