[Yanel-dev] New XMLDB repository

Andreas Wuest awuest at student.ethz.ch
Mon Feb 12 21:29:34 CET 2007


Hi

On 12.2.2007 21:02 Uhr, Michael Wechner wrote:

> I am not sure, because XML can also contain binary data (using CDATA). 
> This is also because one should use application/xml and not text/xml

Just for the record: CDATA cannot contain binary data. See the 
definition of CDATA sections as used in the XML specification:

   Definition: CDATA sections may occur anywhere character data may 
occur; they are used to escape blocks of text containing characters 
which would otherwise be recognized as markup. CDATA sections begin with 
the string "<![CDATA[" and end with the string "]]>"

This states explicitely that the content of CDATA sections, is, well, 
*c*haracter data.

I guess what you are thinking about is embedding binary data in XML 
documents. From http://www.xml.com/pub/a/98/07/binary/binary.html:

   But can you just put "binary" data into an XML document? Meaning, 
"Could we just take an arbitrary stream of bits and plunk it into a 
document?" The answer is no because all the bits in an XML document must 
be legal characters in legal syntax in the same character encoding as 
the rest of the document.

There is, of course, a solution (and what I've already tried to tell you 
this afternoon):

   However, you can encode binary data into characters, and then put the 
result into an XML document.

So, no, an XML can still not contain binary data. It may though contain 
binary data encoded using e.g. Base64.

Everything else is NOT XML, so we can ignore it, and treat it as usual.

-- 
Kind regards,
Andi



More information about the Yanel-development mailing list