[XML-SIG] how to output xml from a python object

Dave Primmer primmer@hotmail.com
Sat, 11 May 2002 06:59:00 -0700


I'd like to do something like take a simple python object and make an xml 
file. I've looked and looked but I can't find any docs on how to do this 
(only parsing). http://ibm.com/developerworks/library/python2/ has some old 
code that refers to modules that aren't available anymore but that's 
basically what i want to do. I don't want xmlPickle or generic marshalling. 
My data format is relatively static and i'd like non-verbose XML. I'm sure 
it's in the archives but I can't download a 22 meg file! (death to 
pipermail)

If there is no xml.dom.builder anymore, how do i build a dom tree and then 
write it out with .toxml()?

I started out by just doing "<"+tag+">" stuff and writing elements for 
everthing but i'd like to be able to do xml attributes also.

i'd like to do:
object.name = 'bob'
object.city = 'sea'
object.desc = '<p>blabedy blah. on and on</p>'
to this:
<object "name="bob" "city"="sea"><desc><p>blabedy blah. on and 
on</p></desc></object>



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.