Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing base64 data in XML?

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?

like image 279
Robin Rodricks Avatar asked Feb 02 '09 10:02

Robin Rodricks


People also ask

What is XML base64?

Xml to base64 encoder tool What is a xml to base64 encoder? This tool converts an XML (Extensible Markup Language) data structure to base64 encoding. It also lets you specify the maximum encoded line length and split output into chunks, or just output it as one continous string.

Can we store base64 in database?

Base64 is only used as a transport mechanism, not for storage. For example, you can embed a base64 encoded image into an XML document or an email message.

Does base64 end in ==?

Base64 deals with the first block (producing 4 characters) and the second (as they are complete). But for the third, it will add a double == in the output in order to complete the 4 needed characters.

Can you decrypt base64?

Base64 is an encoding, the strings you've posted are encoded. You can DECODE the base64 values into bytes (so just a sequence of bits). And from there, you need to know what these bytes represent and what original encoding they were represented in, if you wish to convert them again to a legible format.


2 Answers

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.

like image 189
Greg Beech Avatar answered Sep 29 '22 08:09

Greg Beech


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

like image 30
David Schmitt Avatar answered Sep 29 '22 07:09

David Schmitt