tidy is a swiss army knife for HTML and XML... it does the things you said and a lot more.<p>Pretty printing, switching encodings, conversions between HTML&#x2F;XHTML, validation, removing those stupid quotation marks that MS Word litters all over the place in its vain attempt to ruin the universe... many annoying problems with HTML are easily solved with tidy