• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Selecting Node from XML

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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]/*'
 
Do Re Mi Fa So La Tiny Ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic