Re: [xml] using xmlDocSetRootElement to move nodes between documents



On Wed, Jul 28, 2004 at 12:30:29PM +0200, Martijn Faassen wrote:
The efficiency is the problem. Recursing down the subtree generate
cost. It's possible to share dictionaries for multiple documents,
it's possible to reconciliate namespaces, but entities if not
substitued on parse are a serious problem, you may have to add them
on the internal subset of the target.

This is putting a lot of the burden on the way the documents are
created. Wouldn't it still be useful to have a function that did the
right thing (even if it's relatively slow) when moving nodes from one
document to another?

  yes that would make sense. but sharing dictionnaries in that kind of
applications is IMHO the right way.

Anyway, I guess to implement this API I'll have to go about some other
strategy.

By the way, am I correct in assuming that xmlFreeDoc does not remove any 
nodes that are in that document but not attached to it? I.e. free nodes 
that have just been created but not yet attached, or nodes that are 
unlinked, are not freed, right?

  xmlFreeDoc process recursively from the document node. So if a node is
not attached it won't be freed, except the document dictionnary will likely
be freed and hence you may have dandling pointers in out of scope node left.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team 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]