I am constructing a large HTML document from fragments supplied by users that have the annoying habit of being malformed in various ways. Browsers are robust and forgiving enough but I want to be able to validate and (ideally) fix any malformed HTML if at all possible. For example:
<td><b>Title</td>
can be reasonably fixed to:
<td><b>Title</b></td>
Is there a way of doing this easily in PHP?