Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Selecting Node from XML

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • 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
  • 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]/*'
 
Our first order of business must be this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic