[Python]Xml add a node from another xml document
- by michele
Hi,
I have two xml file:
1)model.xml
2)projectionParametersTemplate.xml
I want to extract from 1) Algorithm Node with his child and put it in 2)
I have wrote this code but it doesn't function.
from xml.dom.minidom import Document
from xml.dom import minidom
xmlmodel=minidom.parse("/home/michele/Scrivania/d/model.xml")
xmltemplate=minidom.parse("/home/michele/Scrivania/d/projectionParametersTemplate.xml")
for Node in xmlmodel.getElementsByTagName("Algorithm"):
print "\nNode: "+str(Node)
for Node2 in xmltemplate.getElementsByTagName("ProjectionParameters"):
print "\nNode2: "+str(Node2)
Node2.appendChild(Node)
This is model.xml link text
This is projectionParametersTemplate.xml link text
Thanks a lot.