n is a text node, I reverified by getNodeType() which returns 3 representing it's a TEXT_NODE. I have no clue as to why it's still returning null.
On Jun 26, 4:26 am, Thomas Broyer <t.bro...@gmail.com> wrote: > On 26 juin, 02:36, G <gaur...@gmail.com> 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 > inhttp://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 Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---