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

Re: [xml] document() and import() handlers



On Sun, Mar 11, 2001 at 11:31:41AM +0000, Matt Sergeant wrote:
> OK, so I've got XML parsing and output working to my satisfaction. What I
> need now is to be able to have libxslt callback to my application for
> document() and xsl:import/include.

   Read http://xmlsoft.org/xmlio.html#General

> I haven't seen any examples of how to do this, and Daniel indicated that
> it might be possible to do by messing with the IO stuff, but didn't tell
> me anything too precise... So I'm looking for more pointers.

   You can register new handlers, based on the URI string they can intercept
the default I/O routines of libxml:
    use xmlRegisterInputCallbacks ()
    http://xmlsoft.org/html/libxml-xmlio.html#XMLREGISTERINPUTCALLBACKS
    again it works with a set of 4 callbacks:
    match()
    open()
    read()
    close()

   If you want to be able to catch entities if you implement a catalog
based on their PUBLIC identifier (libxml don't) then you also need to
register an entity loader:

  http://xmlsoft.org/xmlio.html#entities
  
> For whatever it's worth, in XML::Sablotron you register a schema handler.
> This allows us to set the base to axkit:/path/to/file, and register a
> schema handler for "axkit:".

  Libxml scheme is similar as far as i can tell, should be easy to
get both to work together there.

> Then any relative URI requests go through our
> handler, and http or other requests can be handled elsewhere (do you use
> libghttp internally for http requests?).

  Nahh, libxml has its nanoftp and nanohttp own implementations :-)
    http://xmlsoft.org/html/libxml-nanohttp.html
    http://xmlsoft.org/html/libxml-nanoftp.html
Libxml depends only on libc (and iconv if present) ...

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
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]