File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help - what's the difference: axis following and axis following-sibling?

 
Tong Chen
Ranch Hand
Posts: 1011
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can somebody tell me what is the difference between the axis following and axis following-sibling in the XPath expression?
Give me some examples showing the difference please.
Thanks a lot!
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following page may help you understand the difference:
Zvon.org XPath tutorial: following-sibling axis
Zvon.org XPath tutorial: following axis
Basically, the following-sibling axis selects all siblings of the context node excluding all descendant and attribute nodes of any selected node.
The following axis selects all nodes that follow the context node in the document order excluding any descendant, attribute and namespace nodes of the context node.
 
Ravikiran Muvva
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The following-sibling axis contains all the following siblings of the context node.
The following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes.
I am taking a small example from zvon.org.
a) /AAA/BBB/following-sibling::* of the below document yiedls the result which is in bold.
<AAA>
<BBB>
<CCC/>
<DDD/>
</BBB>
<XXX>
<DDD>
<EEE/>
<DDD/>
<CCC/>
<FFF/>
<FFF>
<GGG/>
</FFF>
</DDD>
<XXX>
<CCC>
<DDD/>
</CCC>
</AAA>
b) /AAA/BBB/following::* yields the result which is in bold
<AAA>
<BBB>
<CCC/>
<DDD/>
</BBB>
<XXX>
<DDD>
<EEE/>
<DDD/>
<CCC/>
<FFF/>
<FFF>
<GGG/>
</FFF>
</DDD>
<XXX>
<CCC>
<DDD/>
</CCC>

</AAA>
For more on this refer http://www.zvon.org/xxl/XPathTutorial/General/examples.html
Hope this helps you.
Ravikiran Muvva
 
Tong Chen
Ranch Hand
Posts: 1011
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, both of you!
I got it now!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic