[XML-SIG] pyxml: currentNode.nodeValue = None?

Thomas B. Passin tpassin@comcast.net
Wed, 08 Jan 2003 00:09:21 -0500


[Nicolas Bourbaki]>
> I've used example from:
>
> http://pyxml.sourceforge.net/topics/howto/node22.html using blast output
XML
> file.
>
> To my surprise despite having sane DTD validated file with nodes like:
>
> <BlastOutput_query-def>01C08  607      0    607
ABI</BlastOutput_query-def>
>
> the currentNode.nodeValue is "None" whereas
currentNode.firstChild.nodeValue
> gives "01C08  607      0    607  ABI"... This can not be right!
>

It is right - it is how the DOM works (I mean the W3C DOM in general, not
just the Python one you are using).  The character data is contained in one
or more text nodes that are children of the containing element node.  If it
happens that your data ends up all in one node , that text node will be the
first child node of the element node.  That is just what you report getting.

Be aware that it is possible to have the character data split up among
several text nodes, and you would then have to collect them all.  This
should not happen in your case if all the files look like your sample.

Cheers,

Tom P