Hey all-
I'm using xml.dom.mindom in Python and have retrieved the book node in the below XML tree. I want to get a list of all children nodes. In this case, I would think there would only be one.
<Book>
<Title>Why is this so hard</Title>
</Book
When I call:
nodeList = bookNode.childNodes
print "nodeList has " + str(nodeList.length) + " elements"
for node in nodeList:
print "Found a " + node.nodeName + " node"
I get the following output:
nodeList has 3 elements
Found a #text node
Found a Book node
Found a #text node
What are these random #text nodes? How do I get the tagName and value for each of the legitimate nodes? I want to get a list of key->value pairs for each of the nodes under Book. I don't want to use getElementsByName because I will not know all of the tagNames ahead of time.
Book -> "Why is this so hard"
Thanks- Jonathan