import libxml2
import sys
class ErrorHandler:
raise Exception, "Error handler did not receive correct argument"
# Memory debug specific
schema="""<?xml version="1.0"?>
<element name="foo"
xmlns:a="http://relaxng.org/ns/annotation/1.0"
xmlns:ex1="http://www.example.com/n1"
xmlns:ex2="http://www.example.com/n2">
<a:documentation>A foo element.</a:documentation>
<element name="ex1:bar1">
<empty/>
</element>
<element name="ex2:bar2">
<empty/>
</element>
</element>
"""
valid="""<?xml version="1.0"?>
<foo><pre1:bar1 xmlns:pre1="http://www.example.com/n1"/><pre2:bar2 xmlns:pre2="http://www.example.com/n2"/></foo>"""
invalid="""<?xml version="1.0"?>
<foo><pre1:bar1 xmlns:pre1="http://www.example.com/n1">bad</pre1:bar1><pre2:bar2 xmlns:pre2="http://www.example.com/n2"/></foo>"""
e = ErrorHandler()
# Test valid document
print "error doing RelaxNG validation"
# Test invalid document
print "Error: document supposed to be RelaxNG invalid"
del rngp
del rngs
del ctxt
# Memory debug specific
print "OK"
else: