OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Define a root in a DTD

>     I have few elements in a DTD and I want to explicity declare one as
>     the root to be used in XML, not the others, is there a way for that ?

No. This is done in the document's document type declaration, not in the
DTD. In a document type declaration like this,

  <!DOCTYPE chapter SYSTEM "docbook.dtd">

the whole point of the "chapter" part is to identify which of the element
types declared in the specified DTD should be used as the root element (also
known as the "document element"--the element to be used to enclose the whole
document). I believe the highest level element in DocBook is set, but I find
it hard to imagine someone creating a document to represent a set of books.
We are free to use set, book, chapter, article, or even para as the document
element for a valid DocBook document.

This is a Good Thing, because it adds flexibility to how the DTD is used.
It's the reason that XML (and SGML) have lent themselves so well to
electronic publishing systems in which different elements were mixed and
matched to create different documents all conforming to the same DTD.

I've seen schema proposals that let you specify which of a schema's element
types could be a document's root element, but after a quick look at section
3.3 of Part 1 of the W3C Schema Rec
(http://www.w3.org/TR/xmlschema-1/#cElement_Declarations) and the RELAX NG
schema for RELAX, I don't believe that either of these let you do this. I
could be wrong.

Bob DuCharme            www.snee.com/bob             <bob@
snee.com>      see http://www.snee.com/bob/xsltquickly for
info on new book "XSLT Quickly" from Manning Publications.