[
Lists Home |
Date Index |
Thread Index
]
- From: Paul Miller <stele@fxtech.com>
- To: "Clark C. Evans" <clark.evans@manhattanproject.com>
- Date: Fri, 17 Dec 1999 09:24:05 -0500
> Thanks James. I think I got it. You use the
> expat events to build the queue, and the use
> the call-backs to process the queue. When
> the queue is empty, you ask expat to load
> the queue with the next chunk of the source.
> This should work like a charm -- and in a
> single thread.
>
> Oh How Pretty!
Yes, I think so. This sounds exactly like what I was trying to do.
Perhaps my implementation was flawed. The problem occurred when I got to
some element data and wanted to "pull" that from within an element
handler.
Say I get called for an element "Point" which has this syntax:
<Point>(x,y)</Point>
When I get to the handler, I'd like to write this:
void PointHandler(XML::Element &elem, Point *point)
{
// "pull" a chunk of element data, but it'll automatically
// stop when it gets to the end of the element (it stops
// when it sees </Point>)
char buf[40];
elem.GetData(buf, sizeof(buf));
sscanf(buf, "%dx%d", &point->x, &point->y);
}
For some reason I couldn't figure out how to make this work, because
with expat I might have hit the element but not necessary gotten to the
character data handler.
I think this will make a lot more sense once I release the code. And
fortunately, I could rewrite the internals (once I figure out how) to
once again layer over expat, without changing the interface.
--
Paul Miller - stele@fxtech.com
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|