Wrong closing tags... (with Form Tag)

Topics: User Forum
Feb 8, 2007 at 3:47 PM
Edited Feb 8, 2007 at 3:48 PM
Hi all,

I want to get a parsed HtmlDocument keeping all the single tags like <br> and <hr> with their valid format : <br />, <hr />, ...

I figured out that I have to put OptionWriteEmptyNodes = true; on the document to keep the closing "/" character in the single tag, otherwise it removes it from all tags occurences (inputs, br, hr, ...).

When I set OptionWriteEmptyNodes = true, I get another problem :

All my form tags are now closed at the opening tags :

<form runat="server" id="frmMain" />
... any html content here...

This is really annoying. Is it due to some bug in the parser or did I do something wrong ? Forgot to configure any option ? (I get this on ALL my pages, so it isn't a unique problem on a single page).

Thanks by advance for your help.

Mar 14, 2007 at 2:39 PM
Change HtmlNode.cs, line 89
ElementsFlags.Add("form", HtmlElementFlag.CanOverlap | HtmlElementFlag.Empty);
and remove the HtmlElementFlag.Empty flag.

At least this works for me...