[xml] Copying XML subtrees across documents (in Python)


What is the recommended way (in the libxml2 Python binding) to copy
a node and all of its children (but not its siblings!) from one
document to another document?

I tried (x is a node in the new document, y a node in the old document):

but in either case (when adding several nodes as children of x) I seem
to get siblings of (only!) the last added node when serializing the new
document (the other nodes are added without siblings).

Any help is appreciated,

--    Jos Vos <jos xos nl>
--    X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--    Amsterdam, The Netherlands        |     Fax: +31 20 6948204

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