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

Question regarding unclosed tag

Sep 30, 2007 at 11:24 AM
Hi everyone,

First of all I would like to say thank you. Because this tool help me a lot.

Actually I'm facing a problem when dealing with some node which closing tag is optional.
For example -- definition list

<dt> 1st entry --
<dd> 11111
<dt> 2nd entry --
<dd> 22222
<dt> 3rdt entry --
<dd> 33333

When I select the inner text of first <dt> node
The result that I get is --> " 1st entry -- 11111 2nd entry -- 22222 3rd entry -- 33333"

The HTML is valid because </dt> closing tag is optional in this case.
But the result that result should be --> " 1st entry --"

Could anyone please guide me how can I solve this problem.
Thanks in advance.
Nov 17, 2007 at 5:02 PM
The Html Agility Pack knows very little about what HTML really is. It basically parses a tag soup :-)
However there is the notion of Nested Tags and associated Resetters Tags in it.
It knows for example about the fact that, obviously, TR that basically closes TD automatically (because that helps bonehead guys like me who forget to close TD tags...).

It does not know about DL, DT, DD, etc... But, if you are willing to change the source code, find the GetResetters method in the code, and add the tags DT, DL, etc...