from xml.dom.minidom import *
resp = "<title> This is a test! </title>"
rssDoc = parseString(resp)
titles = rssDoc.getElementsByTagName('title')
moo = ""
for t in titles:
moo += t.nodeValue;
Gives the following error:
main.py, line 42, in
get moo += t.nodeValue;
TypeError: cannot concatenate 'str' and 'NoneType' objects
The
<title>node contains a text node as a subnode. Maybe you want to iterate through the subnodes instead? Something like this:For learning xml.dom.minidom you might also check out the section in Dive Into Python.