How to save a Jsoup Document to an HTML file?

The fact that there are elements that are ignored, must be due to the attempt of normalization by Jsoup.

In order to get the server's exact output without any form of normalization use this.

Connection.Response html = Jsoup.connect("PUT_URL_HERE").execute();
System.out.println(html.body());

Use doc.outerHtml().

import org.apache.commons.io.FileUtils;

public void downloadPage() throws Exception {
        final Response response = Jsoup.connect("http://www.example.net").execute();
        final Document doc = response.parse();

        final File f = new File("filename.html");
        FileUtils.writeStringToFile(f, doc.outerHtml(), StandardCharsets.UTF_8);
    }

Don't forget to catch Exceptions. Add dependency or download Apache commons-io library for easy and quick way to saving files in UTF-8 format.