Re: [xml] Implementation of JAXP interface using libxml2

Daniel Veillard wrote:
I've tried registering my own external entity loader function with 
xmlSetExternalEntityLoader, but it isn't being called when the parser 
encounters e.g.

  <!DOCTYPE doc SYSTEM "185.ent">

Is there something else I need to do?

  by default libxml2 does not fetch external entities, basic mode of
operation of non-validating parsers. Turn on DTD loading,

I have already called xmlCtxtUseOptions with the XML_PARSE_DTDLOAD flag
before xmlParseDocument with that context (...?)

  Then I have no idea of what's going on, really...

After a fairly extensive debug I've located the problem.

I am supplying a custom xmlSAXHandlerPtr, and swapping out the original
one that was created during xmlNewParserCtxt() - this is the methodology
suggested in the documentation. If I leave the original one in
place (as the "sax" member of xmlParserCtxt) then my external entity
loader function is called. If I replace with my own custom SAX handler,
it isn't. Everything else seems to work as expected though.

Clearly I actually need my own SAX handler functions to be invoked. The
question is, do I really need to proxy the original SAX handler, calling
its methods before/during/after the corresponding methods I define?
Chris Burdess

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