Python minidom

Minidom - Minimal DOM implementation DOM (Document Object Model interface)

XML parse with minidom

   1 from xml.dom import minidom
   2 print("Hello world")
   3 a="<a><b>aaaa</b><b>bbcc</b></a>"
   4 doc = minidom.parseString(a) # return document 
   5 tags = doc.getElementsByTagName("b")
   6 for t in tags:
   7   print(t.firstChild.nodeValue)
   8 
   9 print( doc.toprettyxml() )

Python/minidom (last edited 2018-07-06 16:14:41 by localhost)