Re: On Henry's comment about documents with DOCTYPE but without markup declaration

Henry S. Thompson scripsit:

> What I meant to claim, wrt the examples cited, was that documents
> without a document type declaration _cannot_ be valid, or invalid,
> because the definition of validity depends on _having_ a document type
> declaration.

It seems absolutely bizarre to me to introduce a sense of the word
"invalid" (now used but not defined in the XML Rec) that means anything
other than "not valid".  A document without a DOCTYPE cannot be valid,
as you say, and saying it is _therefore_ invalid seems to me to be the
most natural form of expression.

The term "valid" is defined thus:  "An XML document is valid if it has
an associated document type declaration and if the document complies
with the constraints expressed in it."  If either arm of this logical
conjunction is false, the document is not valid.  I see no benefit to
saying that if the left arm is true and the right arm is false, then the
document is invalid, whereas if the left arm is false the document
is not valid but not invalid either.

If the wording had been "If an XML document has an associated document
type declaration, then the document is valid if it complies with the
constraints expressed in the document type declaration", that would be
another matter.  But that isn't what it says.

> But part of the problem as reported stems from the fact that the
> spec. is unclear wrt what a validating processor should report when
> presented with a well-formed document which lacks a document type
> declaration.

Well, validity errors are reported or not at user option by a validating
parser, as it says under the definition of "validity constraint".

In particular, if there is no DTD, and the user has not chosen to turn
off reporting of validity errors, a validating parser must diagnose a
a violation of the Element Valid VC for every element, and a violation
of the Attribute Value Type VC for every attribute.  The definition
of Element Valid begins "An element is valid if there is a declaration
matching elementdecl where the Name matches the element type" and since
there is not, every element in the document is invalid.  Similarly,
the definition of Attribute Value Type begins "The attribute must have
been declared", and it has not.

> <!DOCTYPE html>
> <xyzzy/>

A validating parser, in addition to reporting a violation of the Element
Valid VC, must also report a violation of the Root Element Type VC, since
"[t]he Name in the document type declaration must match the element type
of the root element".

-- 
In politics, obedience and support      John Cowan <cowan@ccil.org>
are the same thing.  --Hannah Arendt    http://www.ccil.org/~cowan

Received on Tuesday, 28 January 2014 15:49:26 UTC