Problem with pyXML DOM

Florian Lindner Florian.Lindner at xgm.de
Wed May 4 07:03:05 EDT 2005


Hello,
I'm using the PyXML Package.

My XML document looks like that:

<visConf>
    <graph name="testgraph1" type="chart">
    <source type="CSV">
        <filename>/home/florian/visualizer/testdata.csv</filename>
    </source>
        
    </graph>
</visConf>

print sourceNode.getElementsByTagName("filename")[0]
print sourceNode.getElementsByTagName("filename")[0].nodeValue()

gives:

<Element Node at b7af74ac: Name='filename' with 0 attributes and 1 children>

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

Given only the first call everything seems fine, I have a Node object for
the filename.
But why does the second call fails?

The documentationhttp://pyxml.sourceforge.net/topics/howto/node20.html says:


nodeValue
Value of this node. For some types of node, such as Text nodes, the value is
a string containing a chunk of textual data; for others, such as Text, the
value is just None.

Which I don't really understand? What is differencee between the two text
nodes??

Thanks,

Florian



More information about the Python-list mailing list