Java XML Tree Reading continued

Hello,
I have a program which loads an XML document as its config file. I use xpath to retrieve items from it, however, I need to be able to get the names of sub node values (not sure if I am explaining this right). Here is a chunk of the xml config:

<mtas>
      <mta1>
        <bind_ip>192.168.1.115</bind_ip>
        <mta_name>mx1.goforit.com</mta_name>
        <mta_port>25</mta_port>
        <mta_distributor_connections>5</mta_distributor_connections>
        <mta_distribute_to>192.168.1.115</mta_distribute_to>
        </mta1>

      <mta2>
<bind_ip>192.168.1.115</bind_ip>
<mta_name>mx2.goforit.com</mta_name>
<mta_port>25</mta_port>
<mta_distributor_connections>5</mta_distributor_connections>
<mta_distribute_to>192.168.1.115</mta_distribute_to>
</mta2>
-
      <mta3>
<bind_ip>192.168.1.115</bind_ip>
<mta_name>mx3.goforit.com</mta_name>
<mta_port>25</mta_port>
<mta_distributor_connections>5</mta_distributor_connections>
<mta_distribute_to>192.168.1.115</mta_distribute_to>
</mta3>
-
      <mta4>
<bind_ip>192.168.1.115</bind_ip>
<mta_name>mx4.goforit.com</mta_name>
<mta_port>25</mta_port>
<mta_distributor_connections>5</mta_distributor_connections>
<mta_distribute_to>192.168.1.115</mta_distribute_to>
</mta4>
-
      <mta5>
<bind_ip>192.168.1.115</bind_ip>
<mta_name>mx5.goforit.com</mta_name>
<mta_port>25</mta_port>
<mta_distributor_connections>5</mta_distributor_connections>
<mta_distribute_to>192.168.1.115</mta_distribute_to>
</mta5>
</mtas>

as you can see under the <mtas> tag I have 5 other structures defined. I need to be able to retrieve a list of these structures by name and have them returned to me as a comma delimited string... ie I would call a function called getValueList("root/mtas") and it would return to me mta1,mta2,mta3,mta4,mta5.

Worth 500 points.

Thanks,
Rick
   
richardsimnettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

objectsCommented:
be something like:

NodeList nodeList = (NodeList) xpath.evaluate("root/mtas/*, document, XPathConstants.NODESET);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
richardsimnettAuthor Commented:
objects,
Ok from looking at the API I get how to work with a nodelist... however, which function do I use on the individual Node to get the name mta1, etc...?

Thanks,
Rick
0
objectsCommented:
0
richardsimnettAuthor Commented:
Objects,
Thanks for your help... got this working very nicely.

-Rick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.