Re: Ebbeding image data in XML

Alexandre Fayolle <[email protected]>
Newsgroups gmane.comp.python.xml
Message-ID <[email protected]>
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

_______________________________________________
XML-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/xml-sig
signature.asc (application/pgp-signature, 481 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iQEVAwUBQ6hSfl6T+PKoJ87eAQKG3gf/aA1AYzoZfq2PG8gUbNaV8V4vwWQOkgOG
CSD66AZDPzRqKNf9lyFQQcjsnjdvaSiq9IDiPBf6rhCWLmtQnxFpp9nTI2VPL1tI
abiuHbjPFPUHaNl4aMuIk1774v+UJIf3Xn0KWS9lmNWSVv2TD1IIE3xqq7WLxPiL
uQjPC+QFmjrZctaVtHFqk83I/9OITsCGFcr1RDq3pKKYM8++LMvGmWJU7BBVJOgf
aEwdGh1stUdJ4LwFT8wdrSnVz5byKBq8ohN0bp+NltdBz0UZUzw3W/qhSEF3avLO
VuYpi8rdgpnhlTUezrDaDE9ZHWVjNAe1n2HiFUp8JEEXZlRWXZ2fYQ==
=k//b
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.