• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Doubt in XPath Axis

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frnds,

I need to calrify a problem. The following two Axis gives the same result.

child::*
descendant::*

My question is, as it gives the same results, why do we have two separate Axis .Is there any other difference?

Thanks,
Senthil.
 
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lets take an example :-)

And lets assume that we are considering the book node to be the selected node

Originally posted by senthil rajan:


child::*



will select only <title>, <name>, <price>

Originally posted by senthil rajan:


descendant::*



will select <title>, <name>, <first>, <last>,<price>

"child" will select only immediate child elements (that are directly under book element)

"descendant" will slect all elemnts under <book> irrespective of how deep they are nested !!

Hope that helps

[ January 01, 2006: Message edited by: Hari Vignesh Padmanaban ]
[ January 01, 2006: Message edited by: Hari Vignesh Padmanaban ]
 
senthil rajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Crystal Clear.

Thanks Hari

- Senthil.
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic