import xml.dom.minidom as minidom doc = minidom.parse(filename) memoryElem = doc.getElementsByTagName('memory')[0] print ''.join( [node.data for node in memoryElem.childNodes] ) print memoryElem.getAttribute('unit')