SPUG: XML::Parser empty vs. "empty" tags

Colin Meyer cmeyer at helvella.org
Sun Sep 16 02:46:35 CDT 2001

Hi, Jason,

On Sat, Sep 15, 2001 at 09:39:03PM -0700, Jason Lamport wrote:
> At 7:58 PM -0700 9/15/01, Colin Meyer wrote:
> >
> >Simple answer: no.  <tag></tag> and <tag /> are semantically equivalent
> >according to the xml standard.
> Hmmm... do you (or anyone else following this thread) have a 
> reference for where in the XML standard it says that <tag></tag> and 
> <tag /> are semantically equivalent?  That seems like the sort of 
> thing that would be left up to the particular application.  I don't 
> recall the issue ever being mentioned in the O'Reilly book (which is 
> where I generally go for my information on XML).

Sure, the W3C recommended specification for XML 1.0, most easily 
viewable at: http://www.xml.com/axml/axml.html

See section 3.1, the bit about Empty-Element Tags.

  Empty-element tags may be used for any element which has no content,
  whether or not it is declared using the keyword EMPTY.

Because the two forms are semantically equivalent, it is up to the
application to decide on what to do with them. Hence, you are at the
mercy of whatever application you are using at the moment. There is the
"interoperability recommendation" that the <tag /> syntax only be used
for tags that are declared in the DTD to have content type of EMPTY.
This is a nice, but not required for xml applications.

Maybe this discussion would be better on an xml list rather than SPUG,
since we have left the realm of Perl.

Have fun,

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/

More information about the spug-list mailing list