W3C home > Mailing lists > Public > xml-editor@w3.org > January to March 2014

Re: Clarify that documents with DOCTYPE but without markup declaration are not subject to validation

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Thu, 6 Feb 2014 12:30:58 +0100
To: Paul Grosso <paul@paulgrosso.name>
Cc: xml-editor@w3.org
Message-ID: <20140206123058983380.ebe1b719@xn--mlform-iua.no>
Leif Halvard Silli, Thu, 6 Feb 2014 07:56:11 +0100:

> validation has two parts: 1) Check 
> whether the particular rules regarding element content etc defined in 
> the DTD are fulfilled; 2) Check whether the validity constraints are 
> fulfilled as well.

The two parts of validation with reference to the spec:

1) At the top level, validity constraint: [*]

  ]] validity constraint
       [Definition: A rule which applies to all [valid](#dt-valid)
       XML documents. Violations of validity constraints are errors;
       they MUST, at user option, be reported by validating XML
       processors.] [[
       [*] http://www.w3.org/TR/REC-xml/#dt-vc


2) Word ”valid” above pointed to bottom level, valid document: [*]

  ]]   [Definition: An XML document is valid if it has an
       associated document type declaration and if the document
       complies with the constraints expressed in it.] [[
       [*] http://www.w3.org/TR/REC-xml/#dt-valid


This two-layered validation makes sense to em.

For example, there is the validity constraint that the name part of the 
document type declaration (e.g. ”html” in <!DOCTYPE html>) matches the 
name of the root element: ”The Name in the document type declaration 
MUST match the element type of the root element.” On the surface, this 
sounds like a rule that is always possible to verify. After all, what 
is simpler than comparing root element’s name and the DOCTYPE name?

However, note the direction of the rule: It is the DOCTYPE name that 
must be made to match the root element type. Element type name is not 
required to match the DOCTYPE name. And so, when there is no DTD, it 
makes no sense to report that the name in the document type declaration 
does not mach the name of the root element. Because, after all, in such 
a situation - where there is no document grammar available, it is 
impossible to say that any of them conform to a DTD. (And , btw, this 
also illustrates that constructs that match the doctypedecl productoin, 
but without pointing to or including a DTD, constitutes no DTD!)

So, for a document like this one, what is there to report?

   <!DOCTYPE foo>
   <bar/>

It would please me if we can agree that validating processors may only 
report that this document is ”not valid”. And that’s it. Because, the 
condition for performing a check of the validity constraints - a valid 
document, is not present.

Note, btw, for XHTML1 and HTML4, that, while text/html browsers only 
support <html> as the root element, the root element mechanism allows 
you to validate parts of a complete document. E.g. try pasting this 
into the validator at http://validator.w3.org - note the name in the 
DOCTYPE - and yeah, it also validates in my XML editor:

<!DOCTYPE body PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <body xml:lang="en" lang="en">
   <div>
        <p/>
   </div>
 </body>
-- 
leif halvard silli
Received on Thursday, 6 February 2014 11:31:28 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 6 February 2014 11:31:35 UTC