0

是否可以将所有网站内容转换为 XML 文件?意味着如果我提供了网站 URL,那么它将使用 JAVA 将所有网站内容转换为 XML 文件。

如果我给出这个页面的 URL,那么这个页面的所有内容都将在 XML 文件中。

4

1 回答 1

0

下载网站(仅静态内容)的一种非常简化的方法可能是

// read the website from this URL
URL urlIn = new URL("http://www.example.com/index.html");
// save the content as file "/tmp/example.out"
Path pathOut = Paths.get("/tmp/example.out");
// read and write the data
Files.copy(urlIn.openStream(), pathOut, StandardCopyOption.REPLACE_EXISTING);
于 2016-04-11T11:34:26.040 回答