Boost logo

Boost :

From: Wojtek Surowka (wojtek_surowka_at_[hidden])
Date: 2003-08-18 07:37:31


> I have been using expat for a while, and wrapping it in C++ classes.
> It's a very capable parser and supports lot's of stuff.
> My parser stuff is just done with a switch statement (since it's event
> driven), but it would be nice if you could use expat, but then
> "register" your element "handlers" to get called. This would be a cool
> design.

I think it could get too complicated. The base difference between
registered handlers design, and iterators design, is that in the former the
parser has control, and in the latter the client code has control. I think
that because of that fact it can be rather complicated to build iterator
access based on handlers. But the other way around it is easy.

> I don't think I could actually use the "iterator" design that you have,
> since I need to handle the nesting of tags, so I need to know when I am
> started and finished a tag. I also need to know the normal CDATA or
> comments that just came through. Is this possible with the iterator
> idea?

All of it is possible. CDATA support is available now. Comments are not
supported yet. Nesting of tags is supported in the following way: if you
have an iterator i, then ++i moves to the next thing on the same level. If
i points to an element, then you can iterate through its contents with
i->begin() and i->end().

I'll submit the library in short time, and you are very welcome to make
experiments with it.

Regards,
Wojtek


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk