Question

Is there a way to deep clone JSoup Document object and get back exactly same HTML?

I have a pre-parsed object that I want to just clone because I suspect that clone would be faster than always parsing the HTML again.

I've tried to clone it by just iterating through of all the elements of the Document object, but then I'm left without the doctype declaration and such.

P.S. I don't of course expect to get the comments...

Was it helpful?

Solution

For any Node you can call .clone()

This was implemented in feature request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top