my dog learned polymorphism
The moose likes Product and Other Certifications and the fly likes Selecting Node from XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Selecting Node from XML" Watch "Selecting Node from XML" New topic

Selecting Node from XML

Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Howdy ranchers ,

I am new to XML and would like to know one thing. If i have an xml file in which there are lot of parent nodes with lots of child nodes as well. I would like to print selected nodes from the complete xml file, currently if i give alert, it just covers the part of my screen and shows only that much part of xml which the screen can take. So i would like to know how can i particularly select the Parent node only which i want.

an example to quote is as below :

I have an xml called TxnData.xml which has a lot of other nodes inside it.

now i want to see what data is in other child nodes of TxnData.xml which cant see, How can i do that ?

Please help me.

Thanks and regards,


Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
Thomas Bennett

Joined: Jan 09, 2007
Posts: 12
use XPath.
So if you have


If you want to see all child2 child nodes then use XPath of '//parent/child2'

If you want to see only the children of the second parent then
I agree. Here's the link:
subject: Selecting Node from XML
It's not a secret anymore!