Inheritance between DTD's ?
ricko at allette.com.au
Mon Jun 22 18:41:03 BST 1998
> From: James H. Blackwell Jr.
> Is there any sort of "Inheritance" between DTDs ? For example, say you
> have some smaller DTDs and wish to merge them into another larger DTD
> that is more specific.
> If the same tag definition exists between the smaller DTDs or between
> the larger DTD and one you wish to include within it, does the tag
> definition that comes first in the DTD rule ?
First in best dressed, as far as declarations go. First declaration has
precedence. (That way declarations in the "internal subset" override
declarations in the "external subset".)
There is no idea of inheritence in XML DTDs. The model is of textual
inclusion; use the same "entity" model as the instance (though with a more
reader-friendly and consise syntax: I am always surprised at people who
complain about content model syntax, and yet use a BNF in their own
If you want to combine two DTDs which use the same names for any element
types, then you must either combine their content models, which often is not
practical, or to rename one or both elements. There is a draft namespaces
proposal almost finalized now: it is basically a convention for giving a URN
to a particular vocabulary of names, and then, on a per document basis,
renaming the appropriate names in the document using a prefix which invokes
the URN. So you find out the URN to HTML, you decide in your documents to
use the prefix "HTML3:" and make a "namespace declaration" to bind that
prefix to the URN for that document, and then you rename al your ambiguous
element names by prefixing them: i.e. "<HTML3:p>"
P.S. There is a mechanism you can use which will allow you to do what people
use inheritance to do: to be able to say "x is a y" or "x is a y but it also
has z". It in effect says "the content model of x is the same content model
as y" or "the content model of x is the same content model as y but it also
has a z". You do this by putting the content model of x in a parameter
entity, rather than directly. You do the same thing with the attribute
This has been given on this group before, so I won't go into detail. You can
also find it in my book "The XML & SGML Cookbook" under "Type Extension".
The XML & SGML Cookbook, by Rick Jelliffe
Charles F. Goldfarb Series on Open Information Management
656 pages + CD-ROM, Prentice Hall 1998, ISBN 0-13-614223-0
http://www.phptr.com/ > Book Search > "Jelliffe"
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev