from xml.dom.minidom import parse, parseString dom = parse('Special:Allpages') tables = dom.getElementsByTagName("table") pagetable = tables[-1] anchors = pagetable.getElementsByTagName("a") for a in anchors: print a.firstChild.toxml()