[XML-SIG] How to get 4DOM to output empty <elements />

Michael Hudson mwh21@cam.ac.uk
08 May 2000 23:42:16 +0100


"Andrew M. Kuchling" <akuchlin@mems-exchange.org> writes:

> Michael Hudson writes:
> ><img src="blah.gif"></img>
> >which I don't *think* is valid XHTML; certainly validator.w3.org
> >doesn't like it.  
> 
> Then the validator is broken; the XML 1.0 spec says "If an element is
> empty, it must be represented either by a start-tag immediately
> followed by an end-tag or by an empty-element tag."  (Unless XHTML
> specifies that only the empty-element tag is legal.  In which the
> XHTML spec is what's broken.)

That's what I thought.  And in fact the XHTML recommendation says:

    Empty elements must either have an end tag or the start tag must
    end with />.

But it also says (in the "informative" appendix C):

    Also, use the minimized tag syntax for empty elements, e.g. <br
    />, as the alternative syntax <br></br> allowed by XML gives
    uncertain results in many existing user agents.

...

> Can't say off-hand if there's a way to make 4DOM produce empty-element
> tags; don't have the source code here at work...

... so I'd still like to know the answer to this question.  Plus the
empty-element style just looks better to my eyes.

Cheers,
Michael

-- 
6. Symmetry is a complexity-reducing concept (co-routines include
   subroutines); seek it everywhere.
      -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html