Tidy example?

Can anyone provide an example of how to turn HTML to XML (xHTML) using tidy or jtidy? Thanks.

Subject: RE: Tidy example?

Hello Samir,

I use the Firefox extension “Html Validator”, which is based on Tidy. When visiting a web page, the extension displays the number of html errors and warning it’s calculated. If you double-click, a new window opens to display the page source, error and warning details, along with context-sensitive W3C help.

The output is read-only, so I don’t use it to make changes directly. Is that what you would do with Tidy or jTidy? I read the warnings and manually make adjustments to my Domino applications and HTML web pages, and sometimes learn something in the process.

One reference I find handy is the Visibone Browser Book (VisiBone Browser Book), which includes a short, 13-item “HTML → XHTML Migration Checklist”. I’m not sure how well this will display, but some items from their list inlcude:

  • Lower-case elements and attributes: →

  • Nasty NestingNice Nesting



  • Slashify empty elements (always put a space before the slash)

  • paragraph ->

    paragraph

    Endify nonempty elements, even if there's no content

  • Quotify all attribute values:

        or

        1. Use name and id together (except radio buttons).

-etc.

I hope that helps.

Regards and Happy New Year,

Andrew