xml.dom.minidom question

Geoff Gerrietts geoff at gerrietts.net
Tue Oct 7 14:45:13 EDT 2003


Quoting Geiregat Jonas (eniac at sdf-eu.org):
> But how ???

  from xml.dom.minidom import parse

  dom = parse(my_xml_file)

  dom = makeChangesToMyDomTree(dom)

  f = open(my_xml_file)
  f.write(dom.toxml())

You should verify that this works properly but it should. I remember
at one point observing a problem with a document that declared a DTD,
where the DTD was not preserved and invalid XML was dumped. I don't
remember if minidom was the parser I was using, though, and I don't
have the time to test right now.

--G.

-- 
Geoff Gerrietts             "Me and my homies, we tag O.D.."
<geoff at gerrietts net>        --Unknown grafitti artist at a party





More information about the Python-list mailing list