Get Element value with minidom with Python

RailsSon picture RailsSon · Nov 25, 2008 · Viewed 144.3k times · Source

I am creating a GUI frontend for the Eve Online API in Python.

I have successfully pulled the XML data from their server.

I am trying to grab the value from a node called "name":

from xml.dom.minidom import parse
dom = parse("C:\\eve.xml")
name = dom.getElementsByTagName('name')
print name

This seems to find the node, but the output is below:

[<DOM Element: name at 0x11e6d28>]

How could I get it to print the value of the node?

Answer

eduffy picture eduffy · Nov 25, 2008

It should just be

name[0].firstChild.nodeValue