node.ReplaceChild()
<p>How do you use the node.ReplaceChild() method to replace <code>&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;</code> tag with the <code>&lt;br /&gt;</code> tag when the <code>&lt;tr&gt;</code> tag only has 1 <code>&lt;td&gt;</code> tag?</p>

<pre><code>HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.OptionFixNestedTags = true; 
htmlDoc.Load(HttpContext.Current.Server.MapPath("~/myFolder/rpt.html").ToString());
if(htmlDoc.DocumentNode != null) 
{
   HtmlNode trNode = htmlDoc.DocumentNode.SelectSingleNode("//tr"); 
   if (trNode != null)
   {
      //check for more than 1 &lt;td&gt; in the same &lt;tr&gt; 
      bool td = trNode.ToString().StartsWith("&lt;/td&gt;&lt;td"); 
      if (td == false)
      {
          trNode.ReplaceChild("&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;","&lt;br /&gt;");
      }
   }
}
</code></pre>
