• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in XPath Axis

 
senthil rajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • 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.
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Crystal Clear.

Thanks Hari

- Senthil.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic