Re: CDATA vs. EMPTY

* Peter Flynn wrote:
>On Sun, 08 Jul 2001, Bjoern Hoehrmann wrote:
>> Hi,
>> 
>>    XML 1.0 SE says: "An element with no content is said to be empty".
>> Does the following fragment have any content?
>> 
>>   <elem><![CDATA[]]></elem>
>>
>> The Recommendation further reads: "The representation of an empty
>> element is either a start-tag immediately followed by an end-tag, or an
>> empty-element tag". This is true for the fragment in it's canonical
>> representation.

>In answer to your question: yes, your example does have content,
>but it does not have character data content. The direct
>equivalence of <elem/> with <elem></elem> only holds when the >
>of the start-tag is followed directly by the < of the end-tag.

I suggest to clarify XML 1.0 by making the word 'content' in the
definition of 'empty' a reference to '#NT-content'.

Btw.:

  Original Input            | Canonical representation
  --------------------------+-------------------------
  <elem />                  | <elem></elem>
  <elem></elem>             | <elem></elem>
  <elem><![CDATA[]]></elem> | <elem></elem>

Since in the original input the element is not empty, it is in the
canonical representation, I won't call that "logically equivalent",
maybe this should be listed in the "Limitations" section of XML C14N.

(x'posted to the relevant mailing lists)

Thanks for your comments.
-- 
Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/

Received on Sunday, 8 July 2001 21:51:25 UTC