file = 'sample.xml'
xmldoc = xml.dom.minidom.parse(file)
computerNode = xmldoc.getElementsByTagName('computer')
for computerChild in computerNode:
    for parts in computerChild.childNodes:
        for partsChild in parts.childNodes:
            if partsChild.nodeType == xml.dom.Node.ELEMENT_NODE:
                if partsChild.tagName == 'text':
                    pass
how to get direct child nodes not sub-child nodes with same tag name xml minidom python