6 str_io
= StringIO
.StringIO
11 # Memory debug specific
12 libxml2
.debugMemory(1)
14 def myResolver(URL
, ID
, ctxt
):
15 return(str_io("<foo/>"))
17 libxml2
.setEntityLoader(myResolver
)
19 doc
= libxml2
.parseFile("doesnotexist.xml")
21 if root
.name
!= "foo":
22 print("root element name error")
28 doc
= libxml2
.parseFile("doesnotexist.xml")
30 if root
.name
!= "foo":
31 print("root element name error")
37 # Memory debug specific
38 libxml2
.cleanupParser()
39 if libxml2
.debugMemory(1) == 0:
42 print("Memory leak %d bytes" % (libxml2
.debugMemory(1)))