O'Reilly logo

Effective XML: 50 Specific Ways to Improve Your XML by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HTML Tidy

Dave Raggett's HTML Tidy (http://tidy.sourceforge.net) is a wonderful open source tool for cleaning up HTML pages, including converting them to XHTML. Use it. HTML Tidy is a command line tool written in reasonably portable ANSI C that runs on most major platforms. Binaries are available for most platforms. To run it, just put the binary somewhere in your path, and use the --output-xhtml option to indicate you want XHTML output (instead of HTML). For example, the code below converts the file shows.html to XHTML.

C:/>tidy --output-xhtml shows.html

This dumps the converted document onto stdout, from where it can be redirected into a file in the usual way. If you prefer to convert the file in place, use the -m option.

 C:/>tidy --output-xhtml ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required