[Prev][Next][Index][Thread]

Re: B.10 Empty elements?



Since the question has come up about how to get the <e/> notation for
EMPTY elements to work in SGML, here is the example I wrote when I was
wondering the same thing.  (This allows /> to close start-tags even if
they're not EMPTY, of course; restricting it to EMPTY tags would have
to be an XMLism.)

The crucial points are changing NET in the DELIM section, and using
SHORTTAG YES.

John Lavagnino


<!SGML "ISO 8879:1986"

CHARSET

BASESET  "ISO 646:1983//CHARSET
          International Reference Version (IRV)//ESC 2/5 4/0"

DESCSET    0  9 UNUSED
           9  2  9
          11  2 UNUSED
          13  1 13
          14 18 UNUSED
          32 95 32
         127  1 UNUSED

CAPACITY PUBLIC  "ISO 8879:1986//CAPACITY Reference//EN"

SCOPE    DOCUMENT

SYNTAX 

SHUNCHAR CONTROLS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
         18 19 20 21 22 23 24 25 26 27 28 29 30 31 127 255
BASESET "ISO 646:1983//CHARSET International Reference Version
         (IRV)//ESC 2/5 4/0"
DESCSET    0          128         0
FUNCTION   RE                    13
           RS                    10
           SPACE                 32
           TAB        SEPCHAR     9
NAMING     LCNMSTRT   ""
           UCNMSTRT   ""
           LCNMCHAR   "-."
           UCNMCHAR   "-."
           NAMECASE   GENERAL    YES
                      ENTITY     NO
DELIM      GENERAL    SGMLREF
           NET        "/>"
           SHORTREF   SGMLREF
NAMES      SGMLREF
QUANTITY   SGMLREF

FEATURES

MINIMIZE DATATAG NO OMITTAG  YES          RANK     NO  SHORTTAG YES
LINK     SIMPLE  NO IMPLICIT NO           EXPLICIT NO
OTHER    CONCUR  NO SUBDOC   NO           FORMAL   NO
                           APPINFO NONE>
<!DOCTYPE nettest [

<!ELEMENT  nettest  O O  (a*) >

<!ELEMENT  a        O O  ((#PCDATA|b)*) >

<!ELEMENT  b        O O  EMPTY >

]>
<nettest>
<a>Here's an ordinary empty tag: <b>, and then one
with a tricky NET: <b/>, as a test.</a>
</nettest>