Storing base64 data in XML?

不问归期 提交于 2019-11-27 22:55:18

问题


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?


回答1:


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.




回答2:


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




回答3:


There are no characters whatsoever in the Base64 charset that will conflict with XML strings.



来源:https://stackoverflow.com/questions/502814/storing-base64-data-in-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!