from xml.dom.minidom import parse, parseString
dom1 = parse('c:\\temp\\mydata.xml')
datasource = open('c:\\temp\\mydata.xml')
dom2 = parse(datasource)
dom3 = parseString('<myxml>Some data<empty/> some more data</myxml>')
XML parsing in Python