Re: [xml] xinclude and xmlParseChunk



On Wed, Mar 02, 2011 at 09:00:12PM +0000, Lucian Smith wrote:
* Daniel Veillard <veillard redhat com> [2011-03-02 06:31] writes:
On Tue, Mar 01, 2011 at 10:14:30PM +0000, Lucian Smith wrote:
Hello, all.  I am investigating how to modify a system that currently uses 
libxml, with its core parsing done by calling the function 
'xmlParseChunk'.

I would like to expand the capabilities of the system to allow it to 
expand xinclude directives.  However, all the ways I have discovered to do 
this seem to be incompatible with only using xmlParseChunk--the 
'xmlCtxtUseOptions' function does not even check the XML_PARSE_XINCLUDE 
flag.

Is there any way to access xinclude auto-expansion within 'xmlParseChunk'?  
Or am I going to have to pre-process or post-process the data?

xmlParseChunk is somehow a hack, as it not full proper XML parsing.

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

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]