views:

90

answers:

1

Hi,

Curious if anyone has come across a C# library which will clean up invalid html. Basically our CMS has some areas where we allow users to enter in HTML, and invariably this leads to some poorly formatted code.

Example - if someone puts in:

<div><span>blah blah blah</div>

We'd like to rip out any unterminated tags to end up with:

<div>blah blah blah</div>

Hoping to not re-invent the wheel here.

Thanks!

A: 

There's a well-known library name "HTML Tidy": something like http://www.google.ca/search?hl=en&amp;q=html+tidy+c%23 might help.

ChrisW