Automatically coverting HTML to XHTML
Tidy can also quickly convert HTML to XHTML documents. For instance, the php.net homepage:

Converting to XHTML
<?php
    $tidy 
tidy_parse_file("http://www.php.net/", array('output-xhtml' => true));
    
$tidy->cleanRepair();
    echo 
$tidy;
?>