Maniac wrote: > Florian Lindner wrote: > >>Traceback (most recent call last): >> File "ConfigReader.py", line 40, in ? >> c = ConfigReader(f) >> File "ConfigReader.py", line 32, in __init__ >> print sourceNode.getElementsByTagName("filename")[0].nodeValue() >>TypeError: 'NoneType' object is not callable >> >> > This is because nodeValue here is 'None' and 'None()' doesn't make > sense. Looks like you want the thing between <filename> and </filename>. > This is not a nodeValue, this is nodeValue of firstChild of element > 'filename'. So this should work: > > print sourceNode.getElementsByTagName("filename")[0].firstChild.nodeValue
Ok, works perfect. Thanks! But I don't really understand the logic: given I have the node A <filename>path</filename> A.firstChild.nodeValue == path How would the second child of A look like? (ok, None in this case) How would a XML fragment look like that has a second child? What would be the nodeValue of A? for me a child of a node is something like <filename> <child1 /> <child2 /> </filename> Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list