Storing base64 data in XML?

Robin Rodricks picture Robin Rodricks · Feb 2, 2009 · Viewed 21.4k times · Source

How I can store base64 strings in XML?

Do you use CDATA to store base64 strings in XML? Would it help as it allows use of < > within the strings?

Is base64 configurable where you tell it not to use certain chars if they conflict with XML?

Answer

Greg Beech picture Greg Beech · Feb 2, 2009

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.