Re: [xml] xinclude and xmlParseChunk



On Thu, Mar 03, 2011 at 01:03:47AM +0000, Lucian Smith wrote:
* Daniel Veillard <veillard redhat com> [2011-03-03 00:42] writes:

XInclude itself is not integrated in the parse phase, it's always a
post processing option, for example "xmllint --xinclude" just calls
xmlXIncludeProcessFlags() on the resulting document.

You will have to use xmlXIncludeProcessTreeFlags() on all the top
element node that xmlParseChunk may return to you.

Aha--thanks!  That's good to know.  As far as I can tell, xmlParseChunk   
does not return any xmlNodePtr's--am I wrong?

 my mistake, I though you were using a different API. In that case
you have a document which is buiilt progressively, and if you can
wait until the end of the parse to handle XInclude, then
xmlXIncludeProcessFlags() on the ctxt->doc should be just fine

I may actually be using the API you were thinking of; my comment was 
pretty imprecise.  Currently the project uses the callback functions 
startElementNsSAX2Func, endElementNsSAX2Func, charactersSAXFunc, and a few 
others (but not all possible ones).  These particular ones don't return 
nodes, and I didn't see any others on the list that did either, but I 
thought I might have missed one.

  If you're using SAX, you're out of luck ! There is no support in
libxml2 for XInclude at that level.
  If you were to use the reader then you would be able to Expand()
a given node and then do XInclude on it before resuming the Reader, but
for SAX, you will have to implement it.
  http://xmlsoft.org/xmlreader.html#Mixing

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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