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


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: DTD: is declaration order important?

[ Lists Home | Date Index | Thread Index ]
  • From: Richard Tobin <richard@cogsci.ed.ac.uk>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 15 Nov 2000 14:22:42 +0000 (GMT)

> I would like to know if the order of declaration
> with the DTD is important.

Declaration order is not important except for two cases:

 - if you declare the same entity, or attribute for a given element,
   more than once, the first one wins;

 - parameter entities must be declared before they are used, and general
   entities must be declared before they are used in an attribute default.

To interpret these you also need the fact that the internal subset is
taken to precede the external subset.

> How do validating parsers address this
> problem?

They must perform some checking after the whole DTD has been read, in
particular that:

 - the root element has been declared;
 - all NDATA notations have been declared;
 - all ENTITY and NOTATION attribute defaults have been declared;
 - all NOTATIONs in attribute enumerations have been declared.

As you point out, it is not any kind of error to declare attributes
for an element that is never declared.  Nor is it an error for a
content model to refer to an element that is never declared.  Of
course, it will be an error if you have one of these elements in the

-- Richard


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS