Python modify an xml file

Posted by michele on Stack Overflow See other posts from Stack Overflow or by michele
Published on 2010-05-14T17:14:05Z Indexed on 2010/05/17 7:10 UTC
Read the original article Hit count: 288

Filed under:
|
|
|
|

I have this xml model.

link text

So I have to add some node (see the text commented) to this file. How I can do it?

I have writed this partial code but it doesn't work:

xmldoc=minidom.parse(directory)
child = xmldoc.createElement("map")
for node in xmldoc.getElementsByTagName("Environment"):
    node.appendChild(child)

Thanks in advance.

© Stack Overflow or respective owner

Related posts about python

Related posts about Xml