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

  • From: ht@c... (Henry S. Thompson)
  • To: Tim Bray <tbray@t...>
  • Date: Tue, 12 Jun 2001 13:26:24 +0100

Tim Bray <tbray@t...> writes:

> 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?

<sBG
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xsi:type="xs:base64Binary">...</sBG>

[the namespace decls can/should of course be higher up if you have
more than one of these blobs in a document]

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@c...
		     URL: http://www.ltg.ed.ac.uk/~ht/

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