valid xml element in java replaceAll doesnt seem working well
- by John
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