[Home] [By Thread] [By Date] [Recent Entries]
Bjoern Hoehrmann wrote
>
> 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>
>
Yes it does have content. This is quite clear if you look at the grammar
for "content":
[43] content ::= CharData? ((element | Reference | CDSect | PI |
Comment) CharData?)*
Your content clearly contains a CDSect. The fact that the CDSect has no
data is not relevant to the production.
> 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.
True, but then you could argue the same for this:-
<elem><!-- this isn't empty unless the comment is removed --></elem>
Or this:-
<!ENTITY null "">
...
<elem>&null;</elem>
~Rob
|

Cart



