I am creating an input xml to database procedure which i am creating manually through
StringBuilder.append();
finally when all my xml is created i am converting StringBuilder to string by
stringBuilder.tostring()
now the problem is i am getting &(ampersand) in string which i am giving input to oracle\n
stored procedure i have also replaced ampersand by
stringUtils.remove(string,'&')
but still oracle stored procedure is giving error for & (ampersand)
i want ask that is any character is getting converted to “ampersand character” in my string
like
¢ > < " ÷
You shouldn’t really be building XML by hand at all – it’s error prone and pretty much reinventing the wheel. For ongoing development I’d seriously consider a dedicated XML library.
However, if you want to quickly escape such characters look to the Apache Commons Lang library: