This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes text node value null... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "text node value null..." Watch "text node value null..." New topic
Author

text node value null...

mahesh jhamtani
Greenhorn

Joined: Jan 12, 2001
Posts: 11
Hi
I am getting value of text node as NULL.(which is not null)
Can you tell me what is wrong in this code...

Element el = doc.getDocumentElement();
NodeList nl = el.getElementsByTagName("Name");
for (int i=0; i<nl.getLength(); i++)
if(nl.item(i).getNextSibling().getNodeType()== Node.TEXT_NODE)
{Text textNode = (Text)(nl.item(i).getNextSibling());
String text = textNode.getData();
if ((text != null) && text.length() > 0)
System.out.println("value of node is " + text); }
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: text node value null...
 
Similar Threads
getNodeValue() returns null
xml JAVA
Parsing XML doc
How do I detect text wiithin the spantags
Parsing XML with JAXP