Extracting Values from XML tags.

If I have a bit of XML that looks like this:

<Start>

<Open>1</Open>

<Close>2</Close>

</Start>

<End>

<Open>3</Open>

<Close>4</Close>

</End>

I can get the value of the first tag called open with this statement below:

String val = new String();

val = _doc.getElementsByTagName( "First" ).item( 0 ).getChildNodes().item( 0 ).getNodeValue();

But what if I want to search the whole XML file and get the values of all the instances of the <Open> tag. So instead of having my output as just "1", it would be "1, 3" ?

Thanks for all your help!,

-Matt

[710 byte] By [ml23shca] at [2007-9-19]
# 1
Xpath might be the solution for u. This document might be helpful http://www.w3.org/TR/xpathMaking a search in google for xpath may be of great help in case you are looking for examples.
nome02a at 2007-7-8 > top of java,Enterprise & Remote Computing,Enterprise Technologies...