Xpath. How to specify a node between two nodes? -


there may 2 possible structures:

1.

<c>tttt</c> <a>aaaa</a> <b>bbbb</b> <c>cccc</c> <d>dddd</d> <c>cccc</c> 

2.

<c>tttt</c> <a>aaaa</a> <b>bbbb</b> <d>dddd</d> <c>cccc</c> 

how can select node <c> after <b> in first case , if second case, set null?

you can use following-sibling axis purpose :

//b/following-sibling::*[1][self::c] 

brief explanation :

  • b/following-sibling::*[1]: direct sibling following <b>

  • [self::c]: check if sibling <c> element


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -