import xml.dom.minidom as MD from pprint import pprint as pp doc = MD.parse('npclist.xml') doc pp(dir(doc)) print doc.toxml() top = doc.documentElement top print top.toxml() children = top.childNodes children npc1 = children[1] npc1 npc1.toxml() print npc1.toxml() npc1_children = npc1.childNodes npc1_children npcs = top.getElementsByTagName('npc') npcs npcs[0] == npc1 npc1_items = npc1.getElementsByTagName('item') npc1_items npc3 = npcs[2] npc3_items = npc3.getElementsByTagName('item') npc3_items npc1_attrs = npc1.attributes npc1_attrs npc1_attrs.items() dict(npc1_attrs.items()) dict(npc1_attrs.items())[u'class'] npc1_attrs.get('class') npc1_attrs.get('class').value npc1.attributes.get('class').value npc1.toxml() npc1.toxml().encode('ascii')