# -*- coding: utf-8 -*- xml_data=""" """ # do it with sax and pulldom import xml.sax import xml.dom.pulldom d_handler=xml.dom.pulldom.PullDOM() xml.sax.parseString(xml_data, d_handler) d=d_handler.document del d_handler print("with pulldom") print(d, d.documentElement.childNodes) import xml.dom.minidom # do the same thing with minidom d=xml.dom.minidom.parseString(xml_data) print("with minidom") print(d, d.documentElement.childNodes)