[XML-SIG] Ebbeding image data in XML

Alexandre Fayolle alexandre.fayolle at logilab.fr
Tue Dec 20 19:50:38 CET 2005

On Tue, Dec 20, 2005 at 07:33:29PM +0100, Werner F. Bruhin wrote:
> I would like to embed an image in an XML file.
> I was thinking of using PIL.tostring() and put it into the imageasstring 
> element.
> <imagedata>
>     <imagemode>RGB</imagemode>
>     <imagesize>(540, 982)</imagesize>
>     <imageasstring>HERE GOES IMAGE DATA</imageasstring>
> </imagedata>
> Currently I use lxml.etree and get encoding errors when I write the 
> image into the element.
> I would like the file to XML Schema complient, so what "xs:" type should 
> one use for the imageasstring element?

You'll need to encode the imagestring data to base64, and use the
appropriate type.  

Alexandre Fayolle                              LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Retrait du projet de loi DADVSI: http://eucd.info/petitions/index.php?petition=2
Signez cette pétition, et faites-la circuler autour de vous, avant le 20 décembre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : http://mail.python.org/pipermail/xml-sig/attachments/20051220/c833eb57/attachment.pgp

More information about the XML-SIG mailing list