I want to iterate through all attributes of a dom node and get the name and value

I tried something like this (docs were not very verbose on this so I guessed a little):

for attr in element.attributes:
    attrName = attr.name
    attrValue = attr.value
  1. the for loop doesn't even start
  2. how do I get the name and value of the attribute once I get the loop to work?

Loop Error:

for attr in element.attributes:
  File "C:\Python32\lib\xml\dom\minidom.py", line 553, in __getitem__
    return self._attrs[attname_or_tuple]
 KeyError: 0

I'm new to Python, be gentle please

Edit
Report