Re: [xml] why is htmlNewParserCtxt static?



On Sat, Sep 23, 2006 at 05:32:31PM +1000, Michael Day wrote:
Hi Daniel,

  Hi, sorry for the delay, I was first away and then sick ...

The entity loader is passed an xmlParserCtxtPtr, which allows 
document-specific options to be passed in using the _private field and 
used by the entity loader (as long as you don't use xmlReader :) So when 
I parse a document I want to pass in some stuff in the _private field of 
the context.

I've just realised that the XInclude mechanism does not support this, as 
it creates its own XML parser context internally and doesn't provide any 
mechanism to pass in user data via the _private field.

  Right, it really was designed in isolation.

Specifically I am calling xmlXIncludeProcessFlags(), which in turn calls 
xmlXIncludeParseFile(), which creates a new parser context to do the 
parsing.

Is there some way that I could pass in my own xmlParserCtxtPtr to the 
XInclude API?

  I don't think so, at this point.

Alternatively, if the XML_PARSE_XINCLUDE flag applied to the xmlRead* 
functions then there would be no problem, but I understand that this 
flag is only implemented by the xmlReader API at the moment. Would it 
make sense to apply this flag to the regular SAX2 parser as well?

  The problem would be to implement XInclude at the SAX level, it's not
really trivial, it's like a reimplementation, and well it would be hard
to provide the xpointer/xpath support too.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]