wood burning stoves 2.0*
The moose likes Product and Other Certifications and the fly likes help - what's the difference: axis following and axis following-sibling? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "help - what Watch "help - what New topic
Author

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

Tong Chen
Ranch Hand

Joined: Apr 26, 2002
Posts: 1011
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!


Tong Chen (Seattle USA)<br />SCJP,SCWCD,SCDJWS,IBM XML,MCP.NET,MCAD.NET,MCSD.NET
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
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.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Ravikiran Muvva
Greenhorn

Joined: Feb 06, 2003
Posts: 5
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

Joined: Apr 26, 2002
Posts: 1011
Thank you very much, both of you!
I got it now!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help - what's the difference: axis following and axis following-sibling?
 
Similar Threads
how to insert tag into xml document at specific location
Doubt in XPATH - preceding, following
following-sibling and following
Getting Last sibling that had an attribute value
XSLT/XPath predicates: not(), =, !=