+
+ # make sure entities are looked up / available
+ # Based on idea from
+ # http://stackoverflow.com/questions/14731633/how-to-resolve-external-entities-with-xml-etree-like-lxml-etree
+ proc = subprocess.Popen(['xmllint','--noent',filename],stdout=subprocess.PIPE)
+ output = proc.communicate()[0]
+ doc = ElementTree.parse(StringIO.StringIO(output))
+