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



On Wed, Jul 18, 2007 at 11:48:53AM +0200, Stefan Behnel wrote:

;) the recommended way to use libxml2 from Python is lxml.

Thanks, but if anyhow possible, I'd like to stick to something
that is available from stock RHEL5 and python-lxml isn't included
there.

Ok, you want to copy, not move the node, so lxml.etree would do:

   >>> from copy import deepcopy
   >>> x.append(deepcopy(y))

Short and intuitive.

Yes it is, I will certainly consider migrating to lxml.

But isn't there a method that works without lxml?  Now porting my
stuff to lxml is quite some work...

Thanks anyway,

-- 
--    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]