Reputation: 213
I have this in source html that I want to parse
<div>
<iframe><script>alert('hello')</script></iframe>
</div>
When I parse using Jsoup and print the body html I get this.
<div>
<iframe><script>alert('hello')</script></iframe>
</div>
I don't want Jsoup to convert the content inside iframe. How can I do this?. Sample code
Document doc = Jsoup.parse(html);
System.out.println(doc.body().html());
Upvotes: 3
Views: 1327
Reputation: 16498
You can use the unescapeEntities(String,boolean) method of jsoup parser :
Document doc = Jsoup.parse(html);
System.out.println(org.jsoup.parser.Parser.unescapeEntities(doc.body().html(), true));
Upvotes: 2