Re: [xslt] document() source



On Thu, Oct 16, 2003 at 04:10:42PM +0200, Thijs van der Vossen wrote:
> On Thursday 16 October 2003 15:26, you wrote:
> > > Does anyone have any idea how to register I/O handlers or another way to
> > > have the document() function get xml for other sources?
> >
> > have you read the libxml2 examples in libxml2/python/tests especially
> > resolver.py ?
> 
> Thanks. I have now and it cleared up things considerably. Writing a custom
> entity resolver and registering it with libxml2.setEntityLoader() works fine.
> 
> Is it possible to write an custom entity resolver that tries to call the
> libxml2 default entity resolver first, falling back on custom code when that
> fails to load the external entity? When an external entity cannot be loaded I

  Hum, it's easy in C, and would need some work in Python.

> get a warning message on stdout, but it looks like no Exception is triggered.

  Right, it's still basically C code, not python, you have to catch the 
errors, then generate an exception from there might work.

> I also have no idea what the default entity resolver looks like or where it
> is defined in libxml2 of libxml2mod

  xmlIO.c in libxml2

> Maybe it would be better to have the custom entity resolver work with a
> specific uri scheme only, letting the default entity resolver handle the
> others?

  Would require Python wrappers for the xmlIO.h layer. Patch welcome !

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]