I In my last post, I talked about the landmine of stripping HTML comments and at the end I mentioned I hoped I would never have to parse HTML again. Well I?m back at it, but this time I want to strip all HTML from a string. Specifically: Remove all HTML opening and self-closing tags: Thus <foo> and <foo /> should be stripped. Remove all HTML closing tags such as </p>. Remove all HTML comments. Do not strip any text in between tags that would be rendered by the browser. This may not sound all that difficult, but I have a feeling that many existing implementations out there would not pass the set of unit tests I wrote to verify this behavior. I?ll present some pathological cases to demonstrate some of the odd edge cases. We?ll...(read more) ...
Go to the complete details ...