Re: questions about element declarations

At 09:13 AM 9/24/96 +0100, Martin Bryan wrote:
>At 06:35 AM 24/9/96 +0100, W. Eliot Kimber wrote:
>
>>>* Should XML prohibit the use of inclusion and exclusion exceptions in
>>>element declarations? (11.2.4, 11.2.5)?
>>
>>Yes.  Exclusions are, with very rare exceptions, a bad thing, causing much
>>more trouble than they're worth. Inclusions, while expressing a useful
>>semantic, also cause more trouble then they're worth and require DTD
>>processing.
>
>Exclusions are very useful for prohibiting nesting of objects in OR groups
>that are shared, such as those typically found in  %text; parameter entites.
>For example:
>
><!ENTITY % text   (#PCDATA|a|b|c)>
>
><!ELEMENT p (%text;)>
><!ELEMENT a (%text;) -(a)>

I consider this use of exclusions to be *VERY BAD* because it is just a way
to *avoid typing* and does not express a true semantic. If there is a
semantic distinction between having A and not having A it should be
reflected in the content models directly. You can do this by further
subdividing the parameter entities or by simply making the content model
explicit, e.g.:

<!ENTITY % textpart1 "a" >
<!ENTITY % textpart2 "b|c|#PCDATA" >
<!ENTITY % text "%textpart1 | %textpart2" >

<!ELEMENT P  (%text;)* >
<!ELEMENT A  (%textpart2;)* >

Exclusions have too many unwanted (and unobvious) side effects and make
DTD-less parsing difficult or impossible.

For example, what if the content model of B or C includes A? By using
exclusion you have prevented the use of any B or C instances that happen to
include A when they are in an A context, which may or may not be your
intent (but it seems like a very rare case and, I would argue, if it is the
case, then there is a semantic distinction between the A allowed in B and C
and the A that is a peer to B and C in P, which, if made, also solves the
problem without the need for exclusions).

In all of my experience, I have only come upon *one* case where exclusions
solved a real problem, and I was able to avoid the use of exclusions in
that case.

Cheers,

E.
--
W. Eliot Kimber (kimber@passage.com) 
Senior SGML Consultant and HyTime Specialist
Passage Systems, Inc., (512)339-1400
10596 N. Tantau Ave., Cupertino, CA 95014-3535 (408) 366-0300, (408)
366-0320 (fax)
2608 Pinewood Terrace, Austin, TX 78757 (512) 339-1400 (fone/fax)
http://www.passage.com (work) http://www.drmacro.com (home)
"If I never had existed, would you still remember me?..."
                                   --Austin Lounge Lizards, "1984 Blues"

Received on Tuesday, 24 September 1996 10:35:59 UTC