Output XML buffer?

Jan Danielsson jan.m.danielsson at gmail.com
Mon Jun 25 17:22:41 EDT 2007


Hello all,

   I'm using ElementTree to create an XHTML page (mod_python, blah,
blah, blah). When I use ElementTree.tostring(root) to create a buffer
which I want to return to the client, it doesn't include the XML prolog
(obvisouly, since tostring is merely traversing the tree from the node I
supply to it.

   I could simply prefix the tostring output with a string containing my
"<?xml ...>" schtick. But let's, for the sake of argument, say that I
trust a library more to generate it for me, rather than hand coding it
myself (not entirely true, but let's assume that is the case).

-- 
Kind regards,
Jan Danielsson



More information about the Python-list mailing list