Get node name with minidom

北慕城南 提交于 2019-12-22 04:13:18

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/2795462/get-node-name-with-minidom

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!