This project has moved. For the latest updates, please go here.

<link> elements not being parsed/written correctly

Topics: Developer Forum, Project Management Forum
Nov 19, 2009 at 10:26 PM

This seems like a bug - just want to make sure I understand what's happening - maybe others have seen this - 

When parsing an HTML document that has a link element in the head that is closed like:

<link />

It seems the parser interprets this a just an opening tag for link - and then when you write out the HtmlDocument you get:


which of course changes the meaning of the original HTML document.  Has anyone seen a similar problem?

My sample code:

doc = new HtmlAgilityPack.HtmlDocument();

StringWriter sw = new StringWriter();
newContents = sw.ToString();

newContents now has an HTML doc with unclosed link tag...


Nov 20, 2009 at 7:49 AM

For some reason I have similar problem. When I parse meta tags

<meta name="keywords" content="foo" />

I actually get

<meta name="keywords" content="foo">

and its very annoying...