This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Dom parser for XML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Dom parser for XML file" Watch "Dom parser for XML file" New topic
Author

Dom parser for XML file

fang eve
Greenhorn

Joined: Jun 22, 2006
Posts: 26
I have a xml file format in the following format:

<parent>
<values>1</values>
<values>1</values>
<values>1</values>
<values>1</values>
<values>1</values>
<values>1</values>
</parent>

I would like to retrieve all the "values", value. How shld i do it? Thanks

my code is:


[ July 17, 2006: Message edited by: fang eve ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

That code sort of looks right. Except that I don't think your getTextValue() method should be calling getElementsByTagName; that would cause it to look for "values" elements inside your "values" element. And you will want to use the actual element name ("values") that you are interested in, not something that is just similar to it ("Values").
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dom parser for XML file
 
Similar Threads
text node value null...
xml tags writing
Reading XML Values
Efficient XML Parsing
java.lang.string