• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

text node value null...

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
rubbery bacon. crispy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic