Re: Valid vs. well formed Documents

On Mon, 9 Jun 1997 09:56:15 -0400 (EDT) Bernhard Weichel said:
>Some weeks ago, I raise the question if any well formed XML document can
>be "upgraded" to a valid XML document. Occasionally I was misunderstood
>to raise the question on good or bad DTDs.

My apologies for misconstruing your note.

>So I want to raise the question again with a simple example:
>
>
>
><wellformed>
>   <empty, x="foo"/>
>   <empty, x="bar">now empty is not empty</empty>
></wellformed>
>
>
>Is this fragment part of a well formed document?

I believe so.

If we preface it with a DTD, it can also be a valid document instance:

 <!DOCTYPE wellformed [
 <!ELEMENT wellformed (empty+)>
 <!ELEMENT empty      (#PCDATA)>
 <!ATTLIST empty
           x          CDATA       #IMPLIED >
 ]>
 <wellformed>
    <empty, x="foo"/>
    <empty, x="bar">now empty is not empty</empty>
 </wellformed>


The form <e/> is required for all elements declared EMPTY.  It is not
necessarily required for all elements which happen to be empty -- but is
certainly well-formed XML and will be valid SGML after the TC allows the
'sole-tag' (<e/>) form to indicate an element with no content.

-C. M. Sperberg-McQueen

Received on Tuesday, 10 June 1997 19:31:28 UTC