[
Lists Home |
Date Index |
Thread Index
]
- From: Rob Lugt <roblugt@elcel.com>
- To: xml-dev@lists.xml.org
- Date: Wed, 15 Nov 2000 12:16:42 +0000
Sorry to drag you all back to basics and I apologise in advance if we are
going over old ground, but I would like to know if the order of declaration
with the DTD is important. For example, should a validating parser accept
the following xml? :-
<?xml version="1.0"?>
<!DOCTYPE test [
<!ELEMENT test EMPTY>
<!ATTLIST test entity ENTITY #FIXED "xxx">
<!ENTITY xxx SYSTEM "abc" NDATA xxx>
<!NOTATION xxx SYSTEM "xxx.exe">
]>
<test/>
There are a number of points to note here
1) Element test has the attribute "entity" of type "ENTITY" with a fixed
default value of "xxx"
2) Entity "xxx" is a valid external unparsed entity, but it is declared
after the ATTLIST that references it
3) Notation "xxx" is declared after the unparsed Entity that references it.
I believe that this is probably valid, but I have not found a definitive
statement in the XML 1.0 recommendation.
XML 1.0 - 3.3.1 has the following: "Validity Constraint: Entity Name" - ...
each Name must match the name of an unparsed entity declared in the DTD. My
question is - must it have been declared before the reference?
Should it be read as:-
... each Name must match the name of an unparsed entity [previously]
declared in the DTD
or
... each Name must match the name of an unparsed entity declared [elsewhere]
in the DTD
XML 1.0 - 3.3 also gives permission for a warning to be issued if
"attributes are declared for an element type not itself declared". The same
question applies.
One reason why I believe the order of declaration within a DTD should not be
important is due to the internal/external subset structure. Where there is
an internal and external subset, the internal subset is processed first, but
it is quite normal for the internal subset to reference elements of the
external subset. I have seen examples where an unparsed entity declared in
the internal subset uses a notation declared in the external subset.
Therefore I believe that the 'elements' of the DTD should probably not be
validated until all the DTD 'elements' (from both the internal and external
subsets) have been processed.
What are your thoughts on this? How do validating parsers address this
problem?
Regards
Rob Lugt
ElCel Technology
|