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

Re: Empty elements (and processing without a DTD)



At 06:55 PM 09/12/96 +0100, Martin Bryan wrote:
>Such a filter is no worse than the one you would have to write to remove the
>end-tags from XML-EMPTY elements before sending them to a validating SGML
>tool! You can't win with either approach, but I like the use of NET here
>much better than the use of a (to me) unnecessary end-tag. Is keeping a list
>of empty elements that you skip over the end-tag processing rules for such a
>big deal for parser developers?

There is no requirement upon us that an element type which can have no
content, must be declared in SGML using the construct SGML calls "EMPTY
declared content". There are two languages here, therefore we can define the
same document-instance constructs using different meta-constructs. If we go
the NET way, then in XML we say:

   element = start content end | empty
   start   = "<" gi attrs ">"
   end     = "</" gi ">"
   empty   = "<" gi "/>"

And, *later*, in a different language called SGML, we would declare any
empty element types, in either of two way, without making much different;
either as:

(a) EMPTY (if NET-enabling start-tags are allowed for EMPTY, and we change
NET to "/>"), 

or 

(b) as content-ful but allowing or requiring empty instances. 

On the other hand, if we say in XML that there is no special end-tag syntax
rule for empty element (so *all* elements must have their end-tags), then
the DTD we would use in *SGML* to parse such *XML* documents would declare
no empty elements. Therefore there would be no reason to run a filter to
delete end-tags.

>>7 Cooked Bits.  A variant of the Raw Bits (parse it and like it!)
>>approach would be to provide a different syntax for the declarations, to
>>make them really, really easy to parse.
>
>Bang goes any chance of being able to use SGML tools to generate XML!

The fact that the SGML application can't read XML declarations is not a
problem that arises because of export; you would have had to make an SGML
DTD corresponding to the XML declarations in order to load the XML into an
SGML in the first place, and that one would have told the SGML parser what's
EMPTY (under Cooked Bits, EMPTY still exists like in SGML).