# -*- coding: ISO-8859-1 -*-
import sys
import libxml2
# Memory debug specific
ctxt = None
class callback:
global ctxt
print "document start at wrong index: %d expecting %d\n" % (
global ctxt
print "document end at wrong index: %d expecting %d\n" % (
global ctxt
if tag == "bar1":
print "element start at wrong index: %d expecting %d\n" % (
global ctxt
if tag == "bar1":
print "element end at wrong index: %d expecting %d\n" % (
pass
#
# First run a pure UTF-8 test
#
chunk = """ <bar1>chars1</bar1>
<bar2>chars2</bar2>
<bar3>chars3</bar3>
<bar4>chars4</bar4>
<bar5>chars5</bar5>
<bar6><s6</bar6>
<bar7>chars7</bar7>
<bar8>&8</bar8>
<bar9>chars9</bar9>
"""
i = 0
while i < 10000:
i = i + 1
ctxt=None
#
# Then run a test relying on ISO-Latin-1
#
chunk="""<?xml version="1.0" encoding="ISO-8859-1"?>
<foo>
"""
chunk = """ <bar1>chars1</bar1>
<bar2>chars2</bar2>
<bar3>chars3</bar3>
<bar4>ch�rs4</bar4>
<bar5>chars5</bar5>
<bar6><s6</bar6>
<bar7>chars7</bar7>
<bar8>&8</bar8>
<bar9>tr�s 9</bar9>
"""
i = 0
while i < 10000:
i = i + 1
ctxt=None
# Memory debug specific
print "OK"
else: