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

On Tue, Jul 27, 2004 at 08:17:20PM +0200, Martijn Faassen wrote:
Igor Zlatkovic wrote:
On 27/07/04 19:11, Martijn Faassen wrote:
is moving nodes between documents in general not supported this way?

No, it isn't. You must call xmlUnlinkNode to get the node out of the 
first document. Then you can insert it into the new document. And take a 
good care about namespaces, should either document use them.

Unless I'm missing something, this cannot be it, as 
xmlDocSetRootElement() calls xmlUnlinkNode on the node in any case:
I also tried using xmlSetTreeDoc, but that doesn't help either (and it's 
hard to say what to call it in the original document, as I'm moving the 
document element).

  it's really a dictionnary problem, there is no simple fix once the
document is built. The only other option would be to check and cleanup
all potential dictionnary strings when moving nodes this way, very


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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