Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get node name with minidom

Tags:

python

minidom

Is it possible to get the name of a node using minidom?

For example I have a node:

<heading><![CDATA[5 year]]></heading>

What I'm trying to do, is store the value heading so that I can use it as a key in a dictionary.

The closest I can get is something like:

[<DOM Element: heading at 0x11e6d28>]

I'm sure I'm overlooking something very simple here, thanks.

like image 635
Alex Avatar asked May 08 '10 20:05

Alex


1 Answers

Is this what you mean?

tag= node.tagName
d[tag]= node

tagName is defined in DOM Level 1 Core, the basic standard that minidom (mostly) implements.

like image 96
bobince Avatar answered Sep 20 '22 11:09

bobince