in reply to Dynamically cleaning up HTML fragments
Although I am biased towards XML solutions, in this particular case I would choose a different approach. Most if not all (compliant) parsers need an XML document at least to be wellformed in order to parse them correctly. (As you have discovered yourself with your SAX example.) As you XML is not well formed the "XML approach" doesn't make a lot of sense to me. I like some of the other suggestions like html tidy.
|
|---|