使用 CDATA 存储原始二进制流? [英] Use CDATA to store raw binary streams?
问题描述
而不是 将二进制文件保存为 Base64 的开销,我想知道您是否可以直接将双字节二进制流存储到XML文件中,使用CDATA,或者注释掉,还是什么?
Instead of the overhead with saving binary as Base64, I was wondering if you could directly store double-byte binary streams into XML files, using CDATA, or commenting it out, or something?
推荐答案
您可以将其存储为 CDATA,但存在某些字节序列将评估为关闭 CDATA 部分的有效 XML 的风险.快速浏览 http://www.w3.org/TR/2006/REC-xml-20060816/#sec-cdata-sect,看来你可以有任何字符序列除了]]>".看看 什么是有效的 XML 字符 也是.
You can store it as CDATA, but there's the risk that some byte sequences will evaluate to valid XML that closes the CDATA section. After a quick look at http://www.w3.org/TR/2006/REC-xml-20060816/#sec-cdata-sect, it seems you can have any sequence of chars except "]]>". Have a look at what is a valid XML char too.
这篇关于使用 CDATA 存储原始二进制流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!