开发者

How to decode encoded special XML characters in a string?

开发者 https://www.devze.com 2022-12-19 16:50 出处:网络
I was given a string like example.com/test?r开发者_StackOverflowegion=us&lang=en&jurisdiction=us

I was given a string like

example.com/test?r开发者_StackOverflowegion=us&lang=en&jurisdiction=us

How can I write the java code to decode the encoded characters like

& 

in the string. Is there any existing class/method to decode them?

Thanks.


To unescape HTML/XML entities, use Apache Commons Lang StringEscapeUtils or homegrow one.


StringEscapeUtils seems to escape everything


You can also include special characters in XPL. XPL has exactly the same structure as XML, but allows special characters. There is an XML parser with source code available for transformations at http://hll.nu

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号