xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: How to start writing a non-blocking SAX parser
Date Fri, 26 Apr 2002 17:26:43 GMT
Miguel A Paraz wrote:
> Hi,
> On Fri, Apr 26, 2002 at 08:25:11AM -0400, Berin Loritsch wrote:
>>1) Use-Case:  A Non-blocking parser is used to kick off an XML stream to
>>    another location.  IOW, we are not using the results of the stream in
>>    this process.
> I'm sorry but I do not understand this.
> What do you mean by 'kicking off'?
> I'm just going through the stream and calling the content handler in the 
> same way the blocking parse() method does.

Exactly.  "Kicking Off" == starting process.  The idea is that you
aren't concerned with waiting for the results because something else
is handling it.

>>2) Ease of implementation:  We can get the affect of a non-blocking
>>    parser by running the parse in a background thread.  If we need DOM,
>>    we use the concept of a Future (starts processing immediately in
>>    another thread, and only blocks on the first call to the object).
>>    SAX can be kicked off and left alone.
> I would like to contain the processing within a single thread and leave it
> up to clients to do threading if they wish.

Most clients don't care how things are done, just as long as they don't
have to mess with the details.

In essence, you can implement a parser that uses one or more background
threads, pulling information as it is needed.  You can even have the
different threads working on multiple streams--kind of like an event
based architecture.  That would be scalable, and hides the complexity
from the client.

The reason I like JAXP is because I don't have to mess with the details.
I just tell the ParserFactory that I want a non-validating,
namespace-aware parser and *poof* I have one.  User simplicity should be
a desired requirement.

>>Keep in mind that some things like SAX and JAXP have standard interfaces
>>that we simply cannot change.
> I understand this.  I don't claim to follow the official SAX interface;
> instead I'm using it as a base for my own.

:/  You are limiting your users to folks who are willing to be tied to
non-standard interfaces.  That's not alot of folks.


"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin

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