• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Node.getNodeValue() is not parsing "

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to parse a xml document which is going to have a entity references such as & quot; & nbsp; etc.. as Node values.
But when I try to get the node value with the getNodeValue() method of the Node object, it's not giving me the complete content.
Ex :

[Note : I have not typed the entity reference charectors properly here since it's converting it to it's representation.]
Please help.
Thanks in advance.
[ September 21, 2003: Message edited by: Shan Karawita ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder how createXmlDocument(java.lang.String documentURI, boolean doValidate) didn't throw an exception already when you tried to feed the document itself as a string to it? (unless you just typed a quick example)
 
Shan Karawita
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. As you mentioned I have typed a quick example here. It should have been a InputStream.
Has it happend to anyone ....? Please help ... I'm really stucked.
[ September 21, 2003: Message edited by: Shan Karawita ]
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here you are assuming that "C" has only one child ( ie the Text that you typed). It is not the case actually. Even though it appears as if there is only one child of type TEXT, it might have multiple such TEXT nodes.
So it's recommended that you always run through all the child nodes of type TEXT and append the node value. Here i have not checked for the node type, since you dont have any other child elements.
 
Shan Karawita
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much Karthik..... problem is halfway solved.
But it's printing me "This is my null quote null"
Any idea how to overcome this. ?
Thanks in advance.
 
Shan Karawita
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Karthik , I managed to make the change to work.
Here it is.

This really works fine.
Thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic