Reputation: 81
I would like to get all the attributes of one Element (without knowing the names of the attributes). Is there any function for that? Thanks
Upvotes: 7
Views: 8195
Reputation: 766
>>> docu = '<a href="http" alt=":)"></a>'
>>> dom = xml.dom.minidom.parseString(docu)
>>> a = dom.getElementsByTagName("a")[0]
>>> a.attributes.items()
[(u'alt', u':)'), (u'href', u'http')]
Upvotes: 9