Examples of outputSettings()


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

      // the child nodes.
      Document doc = node.ownerDocument();
      boolean oldPrettyPrint = doc.outputSettings().prettyPrint();
      doc.outputSettings().prettyPrint(false);
      converter.output.write(node.toString());
      doc.outputSettings().prettyPrint(oldPrettyPrint);
    }
  }

  /**
   * Recursively processes child nodes, and prepends the given string to the output.
View Full Code Here

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

    }

    protected Document renderTemplate(Template template) throws Exception {
        Configuration conf = Configuration.getConfiguration();
        Document doc = template.getDocumentClone();
        doc.outputSettings().prettyPrint(conf.isOutputAsPrettyPrint());
        InterceptorUtil.executeWithInterceptors(doc, WrapperPageInterceptorList, new Executor<Document>() {
            @Override
            public void execute(Document doc) throws Exception {
                RenderUtil.applySnippets(doc);
                RenderUtil.applyMessages(doc);
View Full Code Here

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

    }

    protected Document renderTemplate(Template template) throws Exception {
        Configuration conf = Context.getCurrentThreadContext().getConfiguration();
        Document doc = template.getDocumentClone();
        doc.outputSettings().prettyPrint(conf.isOutputAsPrettyPrint());
        InterceptorUtil.executeWithInterceptors(doc, WrapperPageInterceptorList, new Executor<Document>() {
            @Override
            public void execute(Document doc) throws Exception {
                RenderUtil.applySnippets(doc);
                RenderUtil.applyMessages(doc);
View Full Code Here

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

        // f.saveUrlAsFile(sLinLink, outFile);
        // f.sleepUnint(1000);
        saveLinFromMovie(elem, outFile);
        m_cLins += 1;
        Writer w = new OutputStreamWriter(new FileOutputStream(sLocalFile),
          docLocal.outputSettings().charset());
        try {
          w.write(docLocal.html());
        }
        finally {
          w.close();
View Full Code Here

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

        public Document parse() throws IOException {
            Validate.isTrue(executed, "Request must be executed (with .execute(), .get(), or .post() before parsing response");
            Document doc = DataUtil.parseByteData(byteData, charset, url.toExternalForm(), req.parser());
            byteData.rewind();
            charset = doc.outputSettings().charset().name(); // update charset from meta-equiv, possibly
            return doc;
        }

        public String body() {
            Validate.isTrue(executed, "Request must be executed (with .execute(), .get(), or .post() before getting response body");
View Full Code Here

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

     */
    public static String clean(String bodyHtml, String baseUri, Whitelist whitelist, Document.OutputSettings outputSettings) {
        Document dirty = parseBodyFragment(bodyHtml, baseUri);
        Cleaner cleaner = new Cleaner(whitelist);
        Document clean = cleaner.clean(dirty);
        clean.outputSettings(outputSettings);
        return clean.body().html();
    }

    /**
     Test if the input HTML has only tags and attributes allowed by the Whitelist. Useful for form validation. The input HTML should
View Full Code Here

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

        assertEquals("<a>One</a> Two Three <i>Four</i> Fix <i>Six</i>", TextUtil.stripNewlines(doc.body().html()));
    }

    @Test public void empty() {
        Document doc = Jsoup.parse("<div><p>Hello <b>there</b></p> <p>now!</p></div>");
        doc.outputSettings().prettyPrint(false);

        doc.select("p").empty();
        assertEquals("<div><p></p> <p></p></div>", doc.body().html());
    }
View Full Code Here

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

        assertEquals("<div><p></p> <p></p></div>", doc.body().html());
    }

    @Test public void remove() {
        Document doc = Jsoup.parse("<div><p>Hello <b>there</b></p> jsoup <p>now!</p></div>");
        doc.outputSettings().prettyPrint(false);
       
        doc.select("p").remove();
        assertEquals("<div> jsoup </div>", doc.body().html());
    }
   
View Full Code Here

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

        assertEquals("su", submit.id());
        Element newsLink = doc.select("a:contains(新)").first();
        assertEquals("http://news.baidu.com", newsLink.absUrl("href"));

        // check auto-detect from meta
        assertEquals("GB2312", doc.outputSettings().charset().displayName());
        assertEquals("<title>百度一下,你就知道      </title>", doc.select("title").outerHtml());

        doc.outputSettings().charset("ascii");
        assertEquals("<title>&#x767e;&#x5ea6;&#x4e00;&#x4e0b;&#xff0c;&#x4f60;&#x5c31;&#x77e5;&#x9053;      </title>",
            doc.select("title").outerHtml());
View Full Code Here

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

        // check auto-detect from meta
        assertEquals("GB2312", doc.outputSettings().charset().displayName());
        assertEquals("<title>百度一下,你就知道      </title>", doc.select("title").outerHtml());

        doc.outputSettings().charset("ascii");
        assertEquals("<title>&#x767e;&#x5ea6;&#x4e00;&#x4e0b;&#xff0c;&#x4f60;&#x5c31;&#x77e5;&#x9053;      </title>",
            doc.select("title").outerHtml());
    }

    @Test
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.