This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 6449 - Document Type detection from VERSION attribute
Summary: Document Type detection from VERSION attribute
Status: NEW
Alias: None
Product: Validator
Classification: Unclassified
Component: check (show other bugs)
Version: 0.8.4
Hardware: All All
: P4 enhancement
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-19 20:49 UTC by Griff Ruby
Modified: 2009-01-23 23:55 UTC (History)
1 user (show)

See Also:


Attachments

Description Griff Ruby 2009-01-19 20:49:06 UTC
A nice thing would be:
1) If the document has no <!DOCTYPE> declaration, and
2) If no Document Override is specified to the validator, and
3) If the document's Attribute "VERSION" of the "HTML" Element tag specifies a valid version of HTML,
Then the document should be parsed in accordance with the version of HTML specified in the VERSION attribute.
The lack of a <!DOCTYPE> declaration would still be a valid warning regarding the document, which would still not be Valid HTML until a <!DOCTYPE> is specified.
e. g. a document that begins with:
<HTML VERSION="-//W3C//DTD HTML 3.2 Final//EN"> 
should be parsed as HTML 3.2.
Comment 1 Olivier Thereaux 2009-01-20 15:10:49 UTC
(In reply to comment #0)
> e. g. a document that begins with:
> <HTML VERSION="-//W3C//DTD HTML 3.2 Final//EN"> 
> should be parsed as HTML 3.2.

That's an interesting idea, but is this used anywhere? Standardized anywhere? 
Comment 2 Griff Ruby 2009-01-23 02:25:29 UTC
> is this used anywhere? Standardized anywhere?

The DTDs for many versions of HTML, including all four flavors of HTML 2.0, HTML 3.2, HTML 4.01, and XHTML 1.1 all include this attribute for the HTML element.  Furthermore, when the attribute VERSION occurs in the HTML element of a file submitted to the present validator, it already checkes its contents against the version of HTML, and if there is a mismatch it issues the error message "value of fixed attribute 'VERSION' not equal to default."
Comment 3 Olivier Thereaux 2009-01-23 11:13:11 UTC
(In reply to comment #2)
> > is this used anywhere? Standardized anywhere?
> 
> The DTDs for many versions of HTML, including all four flavors of HTML 2.0,
> HTML 3.2, HTML 4.01, and XHTML 1.1 all include this attribute for the HTML
> element.  

Indeed, didn't know about that one. I just checked the spec for HTML4.01, which specifies that the VERSION attribute is deprecated as it duplicates the info present in the DOCTYPE declaration:
http://www.w3.org/TR/html401/struct/global.html#h-7.3

So maybe what we can do is:

* if there is a DOCTYPE declaration (or override), use that
* else
    + if there is a html VERSION attribute, 
        use that as a fallback and output a warning stating that 
        DOCTYPE declaration are the prefered identification method
    + else use the default fallback document type

Will have to ping the HTML WG to check that this is sound, but I guess this is feasible indeed.

thanks!
Comment 4 Ville Skyttä 2009-01-23 23:55:16 UTC
(In reply to comment #2)
> The DTDs for many versions of HTML, including all four flavors of HTML 2.0,
> HTML 3.2, HTML 4.01, and XHTML 1.1 all include this attribute for the HTML
> element.

Just for completeness, HTML 4.0/4.01 transitional and frameset have it, HTML 4.0/4.01 strict don't, and no XHTML 1.0 DTD does.