how to replace <br> tag with <br/> tag using HtmlAgilityPack?
See the question and my original answer on StackOverflowYou don't have to replace <br>
by <br/>
manually, if you need to close the node, just instruct the library to do so, for example this:
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml("<br/>");
doc.Save(Console.Out);
will output this:
<br>
and this
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml("<br/>");
doc.OptionWriteEmptyNodes = true;
doc.Save(Console.Out);
will output this:
<br />