editing XML via DOM

J

jaco

Hi,

I'm new to Python and XML but still I want to create something that
includes creating and editing XML using Python.

Now I'm looking for a little example program that does (some of) this to
set me on my way.

Is there something like this available or can somebody give me some
example lines that creates and saves some XML data?

Cheers,
Jaco
 
S

Stephen Thorne

Hi,

I'm new to Python and XML but still I want to create something that
includes creating and editing XML using Python.

Now I'm looking for a little example program that does (some of) this to
set me on my way.

Is there something like this available or can somebody give me some
example lines that creates and saves some XML data?

I use a really forgiving XML library called 'microdom' that resides in
the twisted library. I won't give an example of that - but I do
recommend it if you have a situation where you need to parse crappy
xml.

A quick google comes up with:

http://www.acooke.org/andrew/writing/python-xml.html
which shows how to use xml.dom.ext.reader.Sax.FromXmlFile and then
doing some stuff with createElement, appendChild and
getElementsByTagName.

Regards,
Stephen Thorne
 
U

Uche Ogbuji

jaco said:
Hi,

I'm new to Python and XML but still I want to create something that
includes creating and editing XML using Python.

Now I'm looking for a little example program that does (some of) this to
set me on my way.

Is there something like this available or can somebody give me some
example lines that creates and saves some XML data?

Start with:

http://www.xml.com/pub/a/2002/11/13/py-xml.html

then see:

http://www.xml.com/pub/a/2003/10/15/py-xml.html

Overall, there is a lot on DOM throughout the series:

http://www.xml.com/pub/at/24


--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Use CSS to display XML -
http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html
Full XML Indexes with Gnosis -
http://www.xml.com/pub/a/2004/12/08/py-xml.html
Be humble, not imperial (in design) -
http://www.adtmag.com/article.asp?id=10286UBL 1.0 -
http://www-106.ibm.com/developerworks/xml/library/x-think28.html
Use Universal Feed Parser to tame RSS -
http://www.ibm.com/developerworks/xml/library/x-tipufp.html
Default and error handling in XSLT lookup tables -
http://www.ibm.com/developerworks/xml/library/x-tiplook.html
A survey of XML standards -
http://www-106.ibm.com/developerworks/xml/library/x-stand4/
The State of Python-XML in 2004 -
http://www.xml.com/pub/a/2004/10/13/py-xml.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top