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

Jason Lamport jason at strangelight.com
Sat Sep 15 21:28:07 CDT 2001

Yet another XML::Parser question.  Is there any way, using 
XML::Parser, to differentiate between these two constructs:



	<tag />


Both generate Start and End events.  I would have thought that the 
former construction would also generate a Char event (with the String 
argument set to '', i.e. the empty string) but it doesn't.  In fact, 
I can't find *any* difference in the way XML::Parser processes the 
two different cases.

This is a problem for me because my XML application, like Perl 
itself, makes a distinction between empty strings and null (or undef) 
values.  It seems logical to me to make <tag></tag> refer to the 
empty string and to make <tag /> refer to an undefined value, but I 
can't do that if I have no way of differentiating between the two 


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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