Modify an XML file in Python
Posted
by michele
on Stack Overflow
See other posts from Stack Overflow
or by michele
Published on 2010-05-16T15:10:47Z
Indexed on
2010/05/16
15:20 UTC
Read the original article
Hit count: 307
Hi, I have two file. I have to modify the file one in a particular node and add in a list of child. The list is in the file2. Can I do it, and how?
from xml.dom.minidom import Document
from xml.dom import minidom
file1=modificare.xml
file2=sorgente.xml
xmldoc=minidom.parse(file1)
for Node in xmldoc.getElementsByTagName("Sampler"): # put in the file2 content
Thanks a lot.
© Stack Overflow or respective owner