Re: [xml] Building a DOM tree in python using libxml2
- From: John Fleck <jfleck inkstain net>
- To: xml gnome org
- Subject: Re: [xml] Building a DOM tree in python using libxml2
- Date: Wed, 14 Jul 2004 20:19:22 -0600
On Wed, 2004-07-14 at 16:19, Colin Fox wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi, all.
I posted before about trying to manually build a tree and getting a
segfault.
Maybe I've overlooked something, but I've checked all the documentation
I can find, and can't see any examples of doing this in python.
Can a kind soul out there provide me with a short example on how to
construct a small tree in python? A root with a single text node would
be great.
Thanks,
Here's one:
#!/usr/bin/python -u
import libxml2
doc = libxml2.newDoc("1.0")
root = doc.newChild(None, "root", "some content")
doc.saveFormatFile(("file.xml"),1)
doc.freeDoc()
Cheers,
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]