Getting all the attributes of an item with a minidom

I would like to get all the attributes of one element (without knowing the attribute names). Is there any function for this? Thanks

+4
source share
1 answer
>>> 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')] 
+8
source

All Articles