Function of double slash in XPath / / double slash

Double slash // means any descendant node of the current node in the html tree which matches the locator.

Single slash / means node which is a direct child of the current.

//div[@id='add']//span[@id=addone'] will match

<div id="add"&> <div&> <span id="addone"&> </div&> </div&>


<div id="add"&> <span id="addone"&> </div&>

//div[@id='add']/span[@id=addone'] will match only the second html tree.

/// <summary&>
/// </summary&>
public void Test()
XmlDocument document = new XmlDocument();
XPathNavigator navigator = document.CreateNavigator();
var nodeList = navigator.Select(@"//book[title/@lang = 'it']");

Similar Posts: