andyqee andyqee - 8 months ago 48
HTML Question

what method in jsoup can return the modified html?

When I parse the html file(stored in native) with jsoup. I have modified some elements in the html file,so I want to save the modified html, and replace the old one?

Do any body know which method in jsoup can do the job?

Thank you so much!!!

Answer Source

You could write the contents of either




to file, where document is got from

Document document = Jsoup.connect("http://...").get();
// any document modifications...

like so:

BufferedWriter htmlWriter = 
     new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"));