使用CDATA存储原始二进制流?

问题描述:

除了用节省二进制为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的风险。 //www.w3:快速浏览一下 HTTP后.ORG / TR / 2006 / REC-XML的20060816 /#秒CDATA教派,似乎你可以有字符的任意序列除了]]>。看看什么是有效的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.