Removing a Node from a DOM Tree : DOM : XML PYTHON TUTORIALS


PYTHON TUTORIALS » XML » DOM »

 

Removing a Node from a DOM Tree


from xml.dom import minidom

xmldoc = minidom.parse('stations.xml')
doc_root = xmldoc.documentElement

nodeList = xmldoc.childNodes
for node in nodeList:
    print node.toprettyxml()

doc_root.removeChild(doc_root.childNodes[0])

nodeList = xmldoc.childNodes
for node in nodeList:
    print node.toprettyxml()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo XML
» DOM