Article View: comp.text
Article #1763SGML question
From: Anders Thulin
Date: Mon, 27 Aug 1990 05:26
Date: Mon, 27 Aug 1990 05:26
72 lines
3490 bytes
3490 bytes
SGML gurus, ahoy!
I've been trying to make sense of the SGML standard. I'm beginning to
think that it shouldn't be done at home, and only attempted by highly
trained professionals :-,
The first problem is with the modes used for recognizing delimiters
(section 9.6.1 in the standard). Here is the background:
1) SGML delimiters are recognized only in certain modes. For example,
"<?" is recognized as the PIO delimiter only in the CON and DSM
modes. In other modes "<?" is not regarded as a delimiter.
2) According to section 9.6.1, CON mode delimiters are recognized in
the _content_ rule of the SGML grammar, and in the _marked section_
of marked section declarations that occur in _content_.
This seems to be reasonably clear and unambiguous.
3) Annex F (not formally a part of the standard) says that the
document is scanned in CON mode after the prolog.
This fits reasonably well with the previous rule.
This is my problem. Section 9.6.1 seem to be very clear on the extent
on CON mode: it's essentially used `inside' the _content_ production
[27]. How, then, are delimiters *outside* _content_ recognized?
After folding some irrelevant(?) productions, I find the syntax for a
SGML document entity begins like this:
s*, SGML declaration, prolog, s*, start-tag? content, end-tag?
^CON mode starts here
^or here (Annex F)
These two 'points' are by and large the same: both s* and start-tag
may be empty. No problem so far.
Now, _prolog_ may contain processing instructions, which begin with
the PIO delimiter ("<?"). PIO is recognized only in CON and DSM modes.
And DSM cannot be used in this context - it is used only in
declaration subsets or in marked sections.
Hence, the document must be scanned in CON mode at the *beginning* of
_prolog_. Using the same argument, CON mode recognition must be used
also at the beginning of the document for the SGML declaration.
This seem to be a contradiction with rule 2 above: CON mode
recognition *must* be used also outside of _content_, even though 9.6.1
states the CON delimiters are recognized in _content_ and in the
_marked section_ of ... and so forth.
Is there a contradiction here, or have I missed something important?
---
Another problem is the ">" delimiter. According to the table in Figure
3 (page 31) in the standard, ">" is recognized as either MDC or TAGC
in CTX mode. But I find nothing that says why it should be recognized
as one rather than the other.
I would assume that ">" would be recognized as TAGC if the parser was
currently parsing a _tag_, and as MDC in markup declarations. And this
is the behaviour I would expect from any decent implementation. I just
can't see that it is supported by the standard.
So: would a scanner that recognized ">" as MDC when the person who
created the document meant TAGC strictly speaking be in error?
--
Anders Thulin ath@prosys.se {uunet,mcsun}!sunic!prosys!ath
Telesoft Europe AB, Teknikringen 2B, S-583 30 Linkoping, Sweden
Technical Details
Message-ID:
<555@helios.prosys.se>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!luth!sunic!liuida!prosys!athShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!luth!sunic!liuida!prosys!ath From: ath@prosys.se (Anders Thulin) Newsgroups: comp.text Subject: SGML question Keywords: SGML, ambiguity Message-ID: <555@helios.prosys.se> Date: 27 Aug 90 05:26:56 GMT Organization: Telesoft AB, Teknikringen 2A, S-583 30 Linkoping, Sweden Lines: 72