This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Node Value  Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Node Value  Question" Watch "Node Value  Question" New topic

Node Value Question

Brian Quinn
Ranch Hand

Joined: Dec 23, 2003
Posts: 32
New to XML, trying to learn to get data out of XML file. File reads like
- <chart-config>
- <chart>
Trying to figure out how to pull the values of the XML file out. I am trying to use DOM, but NodeValue always comes out null.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
The JavaDocs for org.w3c.dom.Node have a marvelous table sumarizing what you get from getNodeName and getNodeValue for various subclasses of Node.
The key thing you need to realize is that in XML like this:
You have an Element Node named dataflow that contains a Text Node which has the value "Row". The result of getNodeValue() on the Element Node is null.
You have to get the child node to get the Text Node.
wood burning stoves
subject: Node Value Question
Similar Threads
XSL distinct values
Could you please help me?
xsl for xml tags with similar name
xsl: create href for one tag with value in param among multiple
Mulitple fo:page-sequence