xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <as...@cs.indiana.edu>
Subject Re: How to start writing a non-blocking SAX parser
Date Tue, 30 Apr 2002 21:30:44 GMT
Andy Clark wrote:

> > this function will deliver one callback and return (true
> > indicates that more input is availabel, false is returned
> > when parsing is finished).
> A parser configuration implementing the XMLPullParserConfiguration
> interface does not guarantee that one callback will be performed
> for each call to parse(false). In fact, the number of callbacks
> can be zero, one, or more. The only thing that it guarantees is
> that the parser configuration can break at "reasonable" places
> during parsing and return control back to the application.

that is one of reason why standardization of doing XML  pull parsing
is important.

> The reason that a single callback is not guaranteed is due to the
> pipeline nature of the parser configuration. The configuration is
> made up of a series of components and these components may add or
> remove events in the pipeline. So even if the scanner produces
> only one callback, that callback may turn into multiple callbacks
> as it moves through the pipeline. For example: the namespace
> binding component receives a startElement event and may produce
> any number of startPrefixMapping events in addition to passing
> along the startElement event.
> However, it's certainly possible that a configuration can be
> written that guarantees one and only one callback. It's just
> that one hasn't been written, yet.
> I haven't looked into your XPP2 implementation on top of XNI
> so I don't know how you ensure that only one callback gets
> propagated back to the application. Depending on the information
> that you return this is certainly possible for the standard case
> but there may be other parser configuration where the simple
> approach breaks down.

it gathers information from callback(s) to return to the user just one event.
if XNI parse(false)  were too many callbacks the
xni2xmlpull parser should throw exception (it is _not_ tested ...)

> I have reservations about mixing the API approaches. But that's
> not to say it can't work for all XNI pull-parsing configurations
> and that there's no value in such an attempt. It might even be
> fun to try. :)

you can try an old version that i wrote for XPP2
to use XNI pull parsing, for example look on:

i have also started xni2xmlpull project at sourceforge.net to
implement XMLPULL V1 API (http://www.xmlpull.org)
using Xerces2 - the project is under Apache license.

i would be very interested in making xni2xmlpull into sub-project
of Xerces2 as it would allow users of Xerces 2 to access
and use simple XMLPULL API. my implementation (alpha)
is very small and together with XMLPULL API classes
its jar file should be about 20K addition to Xerces2 jar.

however i do not know what is the current procedure
to create sub project?



In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message