from xml.dom.ext.reader import Sax2 reader = Sax2.Reader() doc = reader.fromStream(open('foo.html'))