Created
April 1, 2019 12:44
-
-
Save rikwatson/00bbe7f2cb34d1a61bbb89a3bc6146e0 to your computer and use it in GitHub Desktop.
Basic XML DOM parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xml.dom.minidom import parse | |
dom = parse("foo.xml") # or dom = parseString( "<myxml>Some data <empty/> some more data</myxml>" ) | |
for node in dom.getElementsByTagName('bar'): # visit every node <bar /> | |
print node.toxml() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment