trouble with minidom

Ronn Ross ronn.ross at gmail.com
Tue Jul 21 20:08:57 EDT 2009


Hello I'm trying to read an xml file using minidome. The xml looks like:
<rootNode>
   <project>
      <name>myProj</name>
      <path>/here/</path>
   </project>
</rootNode>

My code looks like so:
from xml.dom.minidom import parse

dom = parse("myfile.xml")

for node in dom.getElementsByTagName("project'):
   print('name: %s, path: %s \n') % (node.childNodes[0].nodeValue,
node.childNodes[1])

Unfortunately, it returns 'nodeValue as none. I'm trying to read the value
out of the node fir example name: myProj. I haven't found much help in the
documentation. Can someone point me in the right direction?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090721/809e2fa2/attachment.html>


More information about the Python-list mailing list