Re: [xml] xmlRegisterInputCallbacks() from Python?



On Sat, Feb 08, 2003 at 05:01:38PM -0500, Brad Clements wrote:
Howdy,

I've searched the list archives and seen some discussion of this, but that was last year.

I need to be able to register an input callback from within Python so I can override the 
http: uri scheme handler.

  check the examples !

python/tests/resolver.py

-----------------
def myResolver(URL, ID, ctxt):
    return(StringIO.StringIO("<foo/>"))

libxml2.setEntityLoader(myResolver)

doc = libxml2.parseFile("doesnotexist.xml")
root = doc.children
if root.name != "foo":
    print "root element name error"
    sys.exit(1)
doc.freeDoc()
-----------------

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]