From the XML specs…
To allow attribute values to contain
both single and double quotes, the
apostrophe or single-quote character
(‘) may be represented as “'“,
and the double-quote character (“) as
“"“.
Is there a standard or easier way to do it rather than using string find / replace? (apache commons?)
I agree with Jon Skeet. If you really have no choice, consider using StringEscapeUtils.escapeXml from commons-lang.