0
我有兩個xml文件添加一個節點: 1)model.xml 2)projectionParametersTemplate.xml[Python的]的Xml從另一個XML文檔
我想從1提取)算法的節點了他的孩子,並把它在2)
我寫了這段代碼,但它不起作用。
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)
這是model.xml link text
這是projectionParametersTemplate.xml link text
非常感謝。