how to save xml (create with fuctions in xml.dom.minidom

Martin von Loewis loewis at informatik.hu-berlin.de
Wed Aug 1 07:26:50 EDT 2001


"sdf" <wqh-2 at 263.net> writes:

> belowing  is example from document,but how to save newdoc to a file,
> I use writexml,but failed.
> 
> from xml.dom.minidom import Document
> newdoc = Document()
> newel = newdoc.createElement("some_tag")
> newdoc.appendChild(newel)

If I do

newdoc.writexml(open("/tmp/foo.xml","w"))

it works fine for me.

Regards,
Martin



More information about the Python-list mailing list