You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Stephane Felix <fe...@eig.unige.ch> on 2000/10/17 21:37:21 UTC

text nodes

hi all!
Sorry to bother you, but there's something I don't undestand...
When calling getNodeValue() on an element node, I get a null string.... and 
after parsing my xml document, there is no text nodes in the dom tree.
It's like if the parser doesn't remember of all the text there is in my xml 
doc..... :(
is it a bug-feature or does anyone know how to solve that??

thanks

Stephane

Re: text nodes

Posted by Andy Clark <an...@apache.org>.
Stephane Felix wrote:
> When calling getNodeValue() on an element node, I get a null 
> string.... 

The DOM specification states that the node value of an element
node is always null. Text is stored as children of elements in
nodes of type Node.TEXT_NODE. The node value of the text node
will contain the text you are looking for.

Also, don't expect the parser to remove what you consider to
be "ignorable whitespace" from the DOM tree. We *do* have a
feature for this (check the Features documentation page) but
the default behavior is to pass *all* information in the 
document via the DOM tree.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org