c# - When to use double slash in HtmlAgilityPack SelectNodes -


i want loop through rows in table , select

in row.

foreach (var r in table.selectnodes("tr")) {     var paragraphs = r.selectnodes("//p");  } 

why have have use selectnodes("//p") , not selectnodes("p")? if later null.

i'm wondering why don't "//tr" in foreach statement.

as such written //p, in case, find "p" nodes located @ depth within html tree of tr element.

if write /p search in root node of html tree of tr element

example:

with //p find 2 <p> elements, /p not find , null return.

<tr>     <div>        <p></p>     </div>     <div>        <div>            <p></p>        </div>     <div>  </tr> 

in case, if search /p, element found.

<tr>    <p></p> </tr> 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -