import sys
import libxml2
# Memory debug specific
class callback:
global log
global log
global log
global log
global log
global log
global log
global log
chunk="""<foo><bar2/>"""
ctxt=None
print "Error got: %s" % log
print "Exprected: %s" % reference
chunk="""<foo><bar2></bar2>"""
ctxt=None
print "Error got: %s" % log
print "Exprected: %s" % reference
chunk="""<foo><bar2>"""
ctxt=None
print "Error got: %s" % log
print "Exprected: %s" % reference
chunk="""<foo><bar2 a="1" b='2' />"""
ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:"
print "Error got: %s" % log
print "Exprected: %s" % reference
chunk="""<foo><bar2 a="1" b='2' >"""
ctxt=None
print "Error got: %s" % log
print "Exprected: %s" % reference
chunk="""<foo><bar2 a="1" b='2' ></bar2>"""
ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:"
print "Error got: %s" % log
print "Exprected: %s" % reference
chunk="""<foo><bar2 a="b='1' />"""
ctxt=None
print "Error got: %s" % log
print "Exprected: %s" % reference
# Memory debug specific
print "OK"
else: