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

2007-07-18 Thread Jos Vos
Hi,

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):

x.addChild(y)
x.addChild(y.copyNodeList())

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 [EMAIL PROTECTED]
--X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--Amsterdam, The Netherlands| Fax: +31 20 6948204
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


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

2007-07-18 Thread Stefan Behnel

Jos Vos wrote:
 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?

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


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

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.

Stefan

___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


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

2007-07-18 Thread Jos Vos
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 [EMAIL PROTECTED]
--X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--Amsterdam, The Netherlands| Fax: +31 20 6948204
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


[xml] Is libmxl2 supported on VMWare ESX service console?

2007-07-18 Thread Agarwal, Saumya
I get the following error on building libxml on ESX service console -
 
Generating xmlIO.d ...
Generating obj/linux/xmlIO.p ...
xmlIO.c:32:18: zlib.h: No such file or directory
Generating xlink.d ...
Generating obj/linux/xlink.p ...
xlink.c:30:18: zlib.h: No such file or directory
Generating tree.d ...
Generating obj/linux/tree.p ...
tree.c:26:18: zlib.h: No such file or directory
Generating parserInternals.d ...
Generating obj/linux/parserInternals.p ...
parserInternals.c:35:18: zlib.h: No such file or directory
Generating parser.d ...
Generating obj/linux/parser.p ...
parser.c:75:18: zlib.h: No such file or directory
Generating HTMLparser.d ...
Generating obj/linux/HTMLparser.p ...
HTMLparser.c:29:18: zlib.h: No such file or directory
Generating DOCBparser.d ...
Generating obj/linux/DOCBparser.p ...
DOCBparser.c:33:18: zlib.h: No such file or directory
Compiling DOCBparser.c for obj/linux ...
DOCBparser.c:33:18: zlib.h: No such file or directory
make: *** [obj/linux/DOCBparser.o] Error 1

Here are the machine details -
 
[EMAIL PROTECTED] libxml]# uname -a
Linux foo 2.4.21-37.0.2.ELvmnix #1 Mon Sep 25 22:18:34 PDT 2006 i686
i686 i386 GNU/Linux

I am using gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53).
 
Is libxml2 supported on VMware ESX service console which is a stripped
down version of Red Hat Linux 3?
 
Thanks,
Saumya
 
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] Is libmxl2 supported on VMWare ESX service console?

2007-07-18 Thread Bjoern Hoehrmann
* Agarwal, Saumya wrote:
Generating xmlIO.d ...
Generating obj/linux/xmlIO.p ...
xmlIO.c:32:18: zlib.h: No such file or directory

You have to install the zlib development package (and perhaps other
dependencies) prior to building libxml2, either through the package
manager or by building it from source, see http://www.zlib.net/.
-- 
Björn Höhrmann · mailto:[EMAIL PROTECTED] · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml