[jdom-interest] extraneous space in empty element

Amy Lewis amyzing at talsever.com
Thu Oct 12 18:17:23 PDT 2000


On Thu, Oct 12, 2000 at 03:57:21PM -0700, Patrick Dowler wrote:
>
>Is there any reason for an empty element to have a space before the
>trailing slash, a la
>
>	<empty />
>
>rather than 
>
>	<empty/>
>
>Since the trailing space would be dropped from an element name (is that
>true?) it is just cosmetic, but it looks rather peculiar nonetheless.

"browser compatibility"

This is most relevant with relation to XHTML, but may also have an
impact with other XML dialects.  For XHTML, the space between the gi
and the slash prevents the browser from getting confused: it recognizes
"<br />" (as a break, with a weird attribute), but doesn't recognize
"<br/>" (the slash is treated as part of the gi).

It doesn't hurt anything, may help older browsers not barf, and is thus
likely to become a kind of convention in XML (almost every
empty-element outputter I've seen uses the extra space).

Amy!
-- 
Amelia A. Lewis          alicorn at mindspring.com          amyzing at talsever.com
Did you exchange a walk-on part in the war for the lead role in a cage?
		-- Pink Floyd



More information about the jdom-interest mailing list