I have code, somewhat, like this
String str = "<element data=\"some <data>\"> >foo< </element>";
Document doc = Jsoup.parse(str, "", Parser.xmlParser());
But JSOUP unencodes data's value, producing something like this
<element value="some <data>">
>foo<
</element>
How do I prevent JSOUP from unencoding attribute values?
You're hitting a known issue of Jsoup (1.8.3 as of this writing).
See here for details: https://github.com/jhy/jsoup/issues/55
The issue has been posted on December 27 2010... nearly 5 years before your question. I hope the upvotes on it will help raising attention to it.
UPDATE
Jsoup author has closed the issue as WON'T FIX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With