Article View: comp.text.sgml
Article #143Re: HELP: STAGO space problem
From: Eric R. Skinner
Date: Thu, 06 Aug 1992 13:23
Date: Thu, 06 Aug 1992 13:23
85 lines
3469 bytes
3469 bytes
In article <1992Aug6.105115.1680@gp.co.nz> gpwrsjd@gp.co.nz writes:
>Recently a potential problem came to light. (Or is it a problem?)
>
>The problem was the occurance of a STAGO followed by a space and then
>more text (eg. "... end of sentence.< Next sentence ..."). There was
>no matching TAGC.
>
>The parser (Exoterica's XGML Normalizer) passed the occurance without
>commenting on it in any way.
>
>However, the following application produced an error when the
>occurance was encountered.
>
>QUESTION: Should the parser have picked up the STAGO followed by space
>and flagged it? Or was the parser correct in passing it over as if it
>were a piece of text?
A less than character followed by a space is correctly treated as
character data by the Exoterica SGML parser.
It is not interpreted as an STAGO delimiter, due to "delimiter
recognition" rules imposed by the standard.
Clause 9.6: "... a delimiter string is recognized as satisfying a
delimiter role only within the particular recognition mode (or modes)
in which the role is meaningful and, in some cases, only if a
contextual constraint is satisfied."
From Figure 3 in the same clause, we find that an STAGO is recognized
in CON and TAG modes, with a constraint of "GI".
CON mode is the one which concerns us here; it handles delimiter
recognition in content. (TAG mode handles recognition inside tags, to
spot constructions such as "<chap<para>", which is allowed by
SHORTTAG).
Clause 9.6.2 (Contextual Constraints) explains the GI constraint,
which is the key to your problem. The GI constraint means that for a
less than sign to be treated as an STAGO, the less than sign must be
followed by a name start character (an alpha character, but *not* a
space) or a TAGC (or a GRPO if CONCUR is active).
To summarize:
A less than sign is only treated as the start of a start tag if it is
immediately followed by a name start character. Otherwise it is
treated as any other #pcdata character.
This is why the following example contains strictly text data:
I know that x < y because I checked it.
but the following contains the start of trouble:
I know that x<y because I checked it.
You ask:
> If the latter is correct, where should the occurance be trapped
> so as not to be a problem to the following application?
The real problem is that your application is not accepting valid SGML
markup. There are a few other ways of coding the text you describe,
but some of them are just as likely to break your application if it
can't handle the above. For example:
end of sentence.< Next sentence
or using a null declaration:
end of sentence.<<!> Next sentence
or even:
end of sentence.<&space;Next sentence
Hope this answers your question.
By the way, technical questions about Exoterica's SGML products can be
addressed to support@xgml.com.
--
Eric R. Skinner ers@xgml.com
Exoterica Corporation Tel +1 613 722 1700
Ottawa, Canada Fax +1 613 722 5706
Technical Details
Message-ID:
<1992Aug6.132322.18740@xgml.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!uunet.ca!xgml!ersReferences:
<1992Aug6.105115.1680@gp.co.nz>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.sgml Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!uunet.ca!xgml!ers From: ers@xgml.com (Eric R. Skinner) Subject: Re: HELP: STAGO space problem Message-ID: <1992Aug6.132322.18740@xgml.com> Keywords: STAGO, TAGC, error Organization: Exoterica Corporation References: <1992Aug6.105115.1680@gp.co.nz> Date: Thu, 6 Aug 1992 13:23:22 GMT Lines: 85