valid xml element in java replaceAll doesnt seem working well
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-04-19T08:00:57Z
Indexed on
2010/04/19
8:03 UTC
Read the original article
Hit count: 170
Im trying to create a xml file from a POJO , in which i have a property that stores urls, I have been using the below method to replace all & in the url String to make the xml conform to standards and pass it as an html char entity but the string does not change.
public static String forHrefAmpersand(String aURL){ return aURL.replaceAll("&", "&"); }
the value might be www.abc.com/controller?a=1&next=showResults
I have even tried changing the above method to use "/" as i read replaceAll uses regular expression but replaceAll is not working as exprected, Can anyone tell me what is the mistake im doing ? Thanks in advance
© Stack Overflow or respective owner