Subject: Re: DTD element ordering From: mlt@netcom.com (Marcy Thompson) Date: Tue, 11 Apr 1995 18:25:00 GMT
How the Web Was Won
Subject: Re: DTD element ordering From: mlt@netcom.com (Marcy Thompson) Date: Tue, 11 Apr 1995 18:25:00 GMT
Message-ID: 
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
References: <1995Mar28.225425.29439@rsg1.er.usgs.gov> <19950411142511SNOJOW@MVS.sas.com>
Lines: 56
Sender: mlt@netcom.netcom.com

In article <19950411142511SNOJOW@MVS.sas.com> snojow@mvs writes:

>Well, my knowledge of SGML is very limited, but it seems to me that
>a fairly simple, albeit very possibly ambiguous, solution is:
> 
>  
> 
>If this really is ambiguous, I'd appreciate a succinct explanation as
>to why!


It's really ambiguous.

Consider the document instance:


 	blah
	blah
	blah 

It is impossible to determine whether the  is from the B* before
the nested model group, or from the B* in the nested model group,
or from the B* after the nested model group.

The simple rule for detecting ambiguous instances is: if you
cannot tell where in the content model you are, it's ambiguous.

This means "if you cannot tell where you are without looking
ahead", by the way, a distinction that doesn't matter in the
name declaration, but which matters a lot in this one:



  thungummy  

If you look at the whole isntance, you can see that the optional
bar is simply not there, and thus that the first  tag is the
start of the required bar element. However, when the parser encounters
the  tag, it cannot look ahead to see if there is a second
bar element or not, so it cannot decide whether this  is the
start of the optional bar element or of the required one.

You can fix this by moving the optionality to the right:



I'm right in the middle of polishing off my collection of
ambiguous examples for use in the SGML class I'm teaching 
next week, so pardon me if I've run off at the mouth here. :-)

Marcy
-- 
Marcy Thompson
work: marcy@passage.com
play: marcy@world.std.com   mlt@netcom.com



From rballard@cnj.digex.net Sat Mar 29 14:44:37 1995
Status: RO
X-Status: 
Path: news3.digex.net!news2.digex.net!howland.reston.ans.net!ix.netcom.com!netnews