[Expat-discuss] newbie question

Scott Bronson bronson@rinspin.com
Tue, 24 Apr 2001 18:03:32 -0700


On Tue, Apr 24, 2001 at 11:48:48AM +0200, Thomas Vander Stichele wrote:
> I'm kinda new to expat.  I'm trying to write a program which needs to use
> stream-based XML parsing in C.

Me too.  I saw that this is a pretty generic problem, so I tried to
create a reusable library called tagstack.  This just maintains a
stack of elements, and collects all the chardata for each tag into a
single zero-terminated string.  Like Expat, it provides two callbacks,
one for open tag, and one for close.  It doesn't need a chardata
callback, though, because it handles that internally all by itself.

It's still very much a work in progress -- I haven't even written a
full client for tagstack yet.  But the absurdly simple demo works.
You can find what I've done at

	ftp://www.trestle.com/pub/tagstack-0.01.tar.gz

I hope to have it useful in a week or two.  I'd be interested in any
comments on my design of tagstack and its use of Expat.


> b) the doc says that the data inbetween these tags can be spread over
> calls to *XML_CharacterDataHandler).  Based on what is it spread?

It seems pretty complex.  It breaks on a lot of CRs, and some whitespace,
but it's hard to say exactly what.  Just rely on it possibly breaking
anywhere.

	- Scott