[Expat-discuss] empty tags

Michael Isard michael.isard@compaq.com
Mon, 13 Aug 2001 11:16:33 -0700 (PDT)


>On Mon, 13 Aug 2001 10:51:58 -0400 (EDT), "Fred L. Drake, Jr." <fdrake@acm.org> said:

> =?iso-8859-1?q?Sylvain=20PRAT?= writes:
>> yes, but we should be aware of the charset...

>   Yes, pretty flaky stuff.  Here's another approach: for every start
> tag, get the current source index, then for end tags, you know it
> was an empty tag if the position didn't change.  That can be
> optimized a little bit by maintaining a flag:

My code relies on the fact that

  XML_GetCurrentByteCount(parser) == 0

in the end element callback iff the element is empty. I think this is
equivalent to what you propose but avoids storing flags.

Michael.