Web browsers support HTML documents that are not proper XML. For example, browsers allow unclosed <p>
, <link>
, <meta>
or other tags.
In C#, how can I parse an HTML string to an XDocument
and have any invalid XML corrected, instead of an exception being thrown?