【问题标题】:How to save the xhtml file in jsoup如何在jsoup中保存xhtml文件
【发布时间】:2015-12-11 15:38:03
【问题描述】:

我需要能够操作 xhtml 文件的内容,然后将所有内容写回 xhtml 文件。 Jsoup 可以吗?

【问题讨论】:

  • 让我们知道您的尝试,以便其他人可以更好地帮助您。还要详细一点。

标签: java


【解决方案1】:

阅读: How do I load a local html file into Jsoup?

File in = new File(input);
Document doc = JSoup.parse(in, null);

用它做点什么!

要保存:How to save a Jsoup Document to an HTML file?

File f = new File(output);
FileUtils.writeStringToFile(f, doc.outerHtml(), "UTF-8");

【讨论】:

    猜你喜欢
    • 2014-09-02
    • 2017-08-22
    • 2014-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多