Rodolfo
Rodolfo

Reputation: 4183

using HTML Agility Pack to verify HTML not working for me

not sure if I'm missing some option, but <div><b>hello</div> says it's ok (no errors), this is the code (vb) ...

Dim htmlDoc = New HtmlDocument()
htmlDoc.Loadhtml("<div><b>hello</div>")

htmlDoc.ParseErrors.count is 0

Am I missing setting an option or something?

PD: I tried htmlDoc.Loadhtml("<b>hello") and that does return as invalid, not sure why the unclosed <b> inside the <div> doesn't. (I originally posted this in the "code review" site and they said this belonged to Stack Overflow)

Upvotes: 0

Views: 321

Answers (1)

Simon Mourier
Simon Mourier

Reputation: 139095

The library is clearly not a validating tool. The ParsedErrors collection is more a hint for serious problems (that the library considers itself as a serious problem).

If you want a validating tool, HTML Tidy is the standard.

Upvotes: 1

Related Questions