[xml] xmlTextReaderExpand expanding more than just the subtree



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."

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.

I tried doing an xmlCopyNode of the node before expanding it and then
setting the ->next to NULL but it lead to the same parsing errors (I expect
that the "copy" of the node still references the same XMLTextReader memory
structure).

Is there any way to avoid the next nodes, i.e. to only get the subtree when
using expand?

Thanks,
Michael

<<attachment: winmail.dat>>



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