aspose file tools*
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
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Selecting Node from XML" Watch "Selecting Node from XML" New topic
Author

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,

YogendraJ


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

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

<root>
<parent>
<child1/>
<child2/>
</parent>
<parent>
<child1/>
<child2/>
</parent>
</root>

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
'//parent[1]/*'
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Selecting Node from XML