title: C# HtmlAgilityPack adding tbody
body: <p>The C# HtmlAgilityPack, adds tbody element after LoadHtml function, into DOM tree in tables even if it doesn't exists in original HTML document. How can I disable this?</p>
  
  <p>My algorithm creates some XPATH expressions, by traversing the dom tree and that non existing tbody element inside original document makes the SelectNodes not find desired items. Took me a lot of time to figure this out :| </p>
  
  <p>Is it possible to make SelectNodes also consider nodes added by HtmlAgilityPack?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;&lt;td&gt;data&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>My application would produce this XPATH to extract 'data':
  //table/<strong>tbody</strong>/tr/td</p>
  
  <p>The tbody tag in expression was added because its in DOM tree after parsing the html code by HtmlAgilityPack because HtmlAgilityPack added it even if it doesnt exist.
  Because of that </p>
  
  <pre><code>doc.DocumentNode.SelectNodes("//table/tbody/tr/td");
  </code></pre>
  
  <p>would fail.</p>
  
  <p>In other words the tr element (HtmlElement) parent TagName is equal to 'TBODY' not 'TABLE'. Also I'm parsing many different web sites so this is one situation.</p>
  
  <p>SelectNodes is searching in original HTML code, not by DOM tree it has after HtmlDocument.LoadHtml, or it doesn't consider 'virtual' elements added by it.</p>