Secure HTML parser and filter 2010.10.07
HTML parser and filter PHP class
This PHP class comes with a general purpose markup parser class that can parse any type of markup documents similar to HTML, XML, and DTD files.
Secure HTML parser and filter also includes several other classes that can be chained together to retrieve the document token elements returned by the main markup parser class and filter the document elements in a useful way.
More information on the official website.