Re: [xml] xmlTextReaderExpand expanding more than just the subtree



On Mon, Jul 10, 2006 at 03:36:20PM +0200, Michael Ransburg wrote:
Hello!

I'm using the xmlTextReaderExpand to expand a node and then I output the
resulting subtree as a new document using xmlDocDumpFormatMemoryEnc.

Daniel said in an earlier e-mail that:
"The only garantee you have is that xmlTextReaderExpand will expand all the
subtree, it may actually grow more of the tree than just the subtree since
the chunk parsed will in general not end up exactly on the boundary of the
subtree and more data might be processed. So getting a next node is likely,
it's actually one of the ways to be sure the subtree is actually complete."

  And considering how the reader is built it would be near impossible to
avoid that.

What can I do to avoid getting one or more next nodes in my subtree? I tried
setting ->next of the node which I'm expanding to "NULL" but as Daniel
remarked earlier the information which I'm getting from the XMLTextReader
should be treated as read-only and indeed setting ->next to NULL leads to
parsing errors later in the document.

   Well you can change that node temporary for your operation and restore
its state back before any further call to the reader, that should work,

Daniel

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