Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decode encoded special XML characters in a string?

Tags:

java

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.

like image 435
user256239 Avatar asked Feb 11 '10 02:02

user256239


People also ask

How do I parse a special character in XML?

To include special characters inside XML files you must use the numeric character reference instead of that character. The numeric character reference must be UTF-8 because the supported encoding for XML files is defined in the prolog as encoding="UTF-8" and should not be changed.

Does XML accept special characters?

When you use wizards to customize any string in your XML file, you can use the following special symbols: <, >, &, ', ". You can also use these symbols when you are editing a query in Expert Mode or when you are manually entering SQL code into XML files between CDATA tags.

How do I change special characters in XML?

Answer. Special characters (such as <, >, &, ", and ' ) can be replaced in XML documents with their html entities using the DocumentKeywordReplace service. However, since html entities used within BPML are converted to the appropriate character, the string mode of DocumentKeywordReplace will not work in this instance.


1 Answers

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

like image 106
BalusC Avatar answered Oct 18 '22 14:10

BalusC