HTML Agility pack removes break tag close
See the question and my original answer on StackOverflowIt happens because the Html Agility Pack handles the BR in a special way. It still supports old (but existing on the web today) HTML 3.2 syntax where the BR could be declared without a closing tag at all (browsers also still handle it gracefully by the way...).
To change this default behavior, you need to modify the HtmlNode.ElementFlags
property, like this:
Dim doc As New HtmlDocument()
HtmlNode.ElementsFlags("br") = HtmlElementFlag.Empty
doc.LoadHtml("<test>before<br/>after</test>")
doc.OptionWriteEmptyNodes = True
doc.Save(Console.Out)
which will display:
<test>before<br />after</test>