How to decode encoded special XML characters in a string?

匿名 (未验证) 提交于 2019-12-03 02:00:02

问题:

I was given a string like

example.com/test?region=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.

回答1:

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



回答2:

StringEscapeUtils seems to escape everything



回答3:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!