Peter Morris [Air Software Ltd] wrote:
> I want to allow users to enter HTML, but I want to ensure that
> B) The HTML is syntactically correct, so a <li> would have a corresponding
> </li>, a <td> would have a </td>, etc.
According to
<http://www.w3.org/TR/html4/struct/lists.html>
the closing </li> is optional, and according to
<http://www.w3.org/TR/html4/struct/tables.html>
the closing </td> is optional too so a HTML syntax checker would be
wrong to complain about missing closng </li> or </td> tags.
As for HTML syntax checking with .NET perhaps Tidy can help with that:
<http://users.rcn.com/creitzel/tidy.html#dotnet>
I am not sure however it will help if you only want to allow a subset of
HTML but maybe you can write a custom DTD and have Tidy use that.
--
Martin Honnen
http://JavaScript.FAQTs.com/