W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2013

Re: Can root name in DOCTYPE be a XSD-validity thing?

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Mon, 18 Feb 2013 04:59:47 +0100
To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
Cc: xmlschema-dev@w3.org
Message-ID: <20130218045947868382.8758572b@xn--mlform-iua.no>
C. M. Sperberg-McQueen, Fri, 15 Feb 2013 08:15:39 -0700:
> Just one slightly pedantic footnote:

Great! :-)

> On Feb 15, 2013, at 4:00 AM, Leif Halvard Silli wrote:
> 
>> A doctype such as 
>>   <!DOCTYPE TheDocumentElement SYSTEM "ID" [<!--bla, bla-->] >
>> allows to verify
>> 
>>  a) that the DOCTYPE declaration is internally valid, 
>>     namely, that its root/document name and the DTD’s definition
>>     of the root element type, are matching each others,
>>  b) that the root/name part of the DOCTYPE declaration
>>     matches the actual root element of the document (except that
>> 
>> The b) part does not seem technically necessary since this check could 
>> even be performed by checking the document/root element against the 
>> document/root element definition found in the DTD.
> 
> As they are defined by the XML spec, DTDs do not have any
> mechanism (other than the name given in the document type
> declaration) for identifying a particular element as the document
> element in an instance.  It is this which allows a DTD to be used 
> to perform structural validation either on a complete document 
> (for example, a book or an encyclopedia) or upon individual 
> elements which may be stored and managed in separate 
> entities (for example, a chapter in a book or an encyclopedia 
> entry).

Uh, I think I somehow misread the XML 1.0 statement “element type of 
the root element” to mean “element of root element type”.

Hah, and I did not know that http://validator.w3.org would validate the 
following:

<!DOCTYPE p PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<p xmlns="http://www.w3.org/1999/xhtml" >Cool</p>

> So I don't think the check you have in mind can be performed
> solely on the basis of a DTD's internal or external subset -- it
> requires the document type declaration.

Right. And as such, it is a very flexible system since it allows any 
element to serve as root. What about XSD in this regard? Perhaps XSD 
”hard codes” which elements can serve as root element?
-- 
leif halvard silli
Received on Monday, 18 February 2013 04:00:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 18 February 2013 04:00:19 GMT