You can just store it as a text or attribute value; no escaping or CDATA sections needed. The standard base 64 characters + and / (other than a-z, A-Z and 0-9) do not interfere with XML parsing at all.


Base64 only uses alphanumeric characters and '+' (plus), '/' (slash) and '=' (equals). No need to encode anything for XML.