I am trying to load simple html:
var html = "<div>something<p></p></div>"; var doc = new HtmlDocument(); doc.LoadHtml(html);
After loading this HTML
doc.InnerHtml outputs this:
So as you can see it loses closing P tag and I got messed HTML.
I cannot find any solution for this, can anyone help me please.
OptionWriteEmptyNodes flag is what you're looking for:
Defines if empty nodes must be written as closed during output.
And in your case:
doc.OptionWriteEmptyNodes = true;