I'm about to start writing a class for performing HTML cleanup and perhaps validation. Before doing that, however, I'd like to know if there is already some PHP extension that could do that. It would be easier, as well as faster. If not, could you perhaps give me some advice on the implementation? I mean, replacing ALL tags would be a relatively easy task. But how about removing all tags that are not in a set of allowed tags?
PS: please don't give me the strip_tags function. I know it's there, but I'd rather not use it. It has its flaws, I've experienced some with it and I've seen others have problems with it.
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.