Are both the HTML Tidy check and the SGML Parser check necessary for XHTML compliance?

368 views Asked by At

If I want to be XHTML strict and my headers are as follows:

<!DOCTYPE html PUBLIC
          "-//W3C//DTD XHTML 1.0 Strict//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

If I pass the HTML Tidy check is the SGML Parser check also necessary given that I want to be XHTML compliant? (I have no real reason for this, I'm just being fussy until I have a reason to be less fussy.) When I look at the "Cleanup" suggested output from the Firefox plug-in validator, it gives the following code that is missing the closing part of the <input> tag.

<form method="post" action="set_anonymous">
    <input type="submit" value="Be anonymous">
</form>

Does this kind of "cleaned up" code suggest I am using the validator improperly?

1

There are 1 answers

0
darioo On

Have you tried going the other way? XHTML documents are plain XML files and their schema is defined in a dtd file.

That means any xml validator can tell you if your document is valid or not.

This is how you can validate if a document is proper:

Download XMLstarlet.

Go to XHTML dtd page and download these files:

  • xhtml1-strict.dtd
  • xhtml-lat1.ent
  • xhtml-special.ent
  • xhtml-symbol.ent

put them all in one folder. Inside that folder, put your XHTML document (let's call it test.xhtml) and run the following command:

xml val -e -d xhtml1-strict.dtd test.xhtml

If your response is "test.xhtml - valid", you've got a valid document.

If not, the -e flag will tell you what went wrong.