xml.dom.minidom question

Greg Krohn ask at me.com
Tue Sep 30 13:48:46 EDT 2003


"Geiregat Jonas" <eniac at sdf-eu.org> wrote in message
news:3f79ad4b$0$10696$ba620e4c at reader2.news.skynet.be...
> I'm using xml.dom.minidom, I get some data by using
> obj.getElementsByTagName("name")[0] then I have an object, but how can I
> get the data between the tags ? I could do .toxml() and then strip it
> away. But is there a better way maybe a function made for it ?
> Also is it possible using the xml.dom.minidom module to create modify an
> xml file ?

Given <name>Greg</name>, 'Greg' is considered an element inside the 'name'
element. So, all you have to do is go one level of elements deeper.

myname = obj.getElementsByTagName("name")[0].childNodes[0].data


greg






More information about the Python-list mailing list