On 26 juin, 02:36, G <[email protected]> wrote:
> import com.google.gwt.xml.client.NodeList;
> import com.google.gwt.xml.client.XMLParser;
> import com.google.gwt.xml.client.Node;
> import com.google.gwt.xml.client.Document;
>
> :
> :
>
> Node n = (Node) node.getFirstChild();
> Window.alert(n);
> String text = n.getNodeValue();
>
> "text" returns null even though when I try to print "n" there is some
> text. whats wrong with getNodeValue() ??!
There's a table in http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
which summarizes what you can expect from nodeValue depending on the
node type. You'll note that it is 'null' in many cases.
If 'n' above is not a Text node (or Comment node, CDATA node, etc.)
then 'text' will be 'null'. AFAICT, there's no shortcut in "core DOM"
to get the "text content" of an Element node, you have to walk the
subtree and accumulate the Text/CDATA nodes' nodeValue.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---