[Home] [By Thread] [By Date] [Recent Entries]

  • From: Tim Bray <tbray@t...>
  • To: xml-dev@l...
  • Date: Mon, 11 Jun 2001 17:22:54 -0700

At 07:18 PM 11/06/01 -0400, Steve Rowe wrote:
>Sounds like you need to convert the binary data which you're
>attempting to store in a CDATA section into a form which will be XML
>compliant.  The standard solution for this problem is Base64 encoding.

If it's base64, you don't need to use a CDATA section; one of
the nice things about base64 is it doesn't use < or > or & -
[/+a-zA-Z0-9] if I recall correctly.  Furthermore, base64 is 
smart about whitespace, so you can even make it look pretty.  
Works very nicely indeed with XML, if it didn't exist we would 
have had to invent it.

  <someBinaryGibberish encoding="base64">
ZA3yL5Q237IPQ9pE5C/opo7FBLpmRCfOh20VsjhVtKyohMyFMpJlEUXszyU0hMOdM6c5gfsv
...etc...
fqraUBbFv4+63t/Gi48VokezN3i5RkxZcXtdZiuNBttATtK945stryFg7k/YkpMG4e6plaL1
   </someBinaryGibberish>

I'm sure there are some xsd: attributes you could use to say 
in a standardized way that this is base64, but <blush> I don't
know it.  XSD gureaux?

I'm always happy to avoid using CDATA sections if I can. -Tim


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member