File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Iterating same level nodes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Iterating same level nodes" Watch "Iterating same level nodes" New topic
Author

Iterating same level nodes

John Best
Greenhorn

Joined: Oct 02, 2011
Posts: 9

Hi there,

<World>
<Country>Argentina</Country>
<Country>Bangladesh</Country>
<Country>China</Country>
<Country>Denmark</Country>
<Country>Iran</Country>
<Country>Iraq</Country>
</World>

how to iterate the above XML to get the Country's


Have a nice day
JB
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12267
    
    1
You need to get familiar with the standard Java library for manipulating XML.

Given the "World" org.w3c.Dom.Eement, you can getElementsByTagName("Country") to get a NodeList which you can use to iterate.

Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Iterating same level nodes
 
Similar Threads
The fastest way to have peace on earth
14th and 15th Centuries - not the Darkest Ages
Japan&#8217;s Love For Bicycle
Do the Taliban smoke the opium too?
Mapping