Dim NewHTMLString As String = XDocument.Parse(htmldoc.DocumentNode.OuterHtml).ToString()
Produces this error:
The '"' character, hexadecimal value 0x22, cannot be included in a name.
This is the line in the HTML it says is wrong:
XDocument thinks this part :
<scr", as beginning of an XML node and double-quote (
") character in the XML node name is considered invalid.
I was using
XDocument in the answer to your previous question to get beautifully formatted XML output in console, and I did that because I know exactly that my HTML is XML compliant. In this case, your HTML isn't valid from XML point of view and it isn't clear what you're trying to achieve using
XDocument here. If you simply need to check result from modification you did to the original HTML, you can either directly print
htmldoc.DocumentNode.OuterHtml to console or save the HTML to a new file like so :