% (msg)

handler = callback()

ctxt = libxml2.createPushParser(handler, "&lt;foo", 4, "test.xml")
chunk = " url='tst'&gt;b"
ctxt.parseChunk(chunk, len(chunk), 0)
chunk = "ar&lt;/foo&gt;"
ctxt.parseChunk(chunk, len(chunk), 1)

reference = "startDocument:startElement foo {'url': 'tst'}:" + \ 
            "characters: bar:endElement foo:endDocument:"
if log != reference:
    print "Error got: %s" % log
    print "Expected: %s" % reference</pre><p>The key object in that test is the handler, it provides a number