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

StackOverflow https://stackoverflow.com/questions/4194486

  •  11-10-2019
  •  | 
  •  

문제

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...

도움이 되었습니까?

해결책

For any Node you can call .clone()

This was implemented in feature request.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top