【发布时间】:2010-05-25 14:38:13
【问题描述】:
我有两个 xml 文件: 1)模型.xml 2)projectionParametersTemplate.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
非常感谢。
【问题讨论】: