Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Non-blocking XML Parsing

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Tatu Saloranta <cowtowncoder AT yahoo.com>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Non-blocking XML Parsing
  • Date: Wed, 14 Oct 2009 19:29:15 -0700 (PDT)

--- On Mon, 10/12/09, Norman Elton <normelton AT gmail.com> wrote:

> From: Norman Elton <normelton AT gmail.com>
...
> I've got an XML-based network protocol. Each request constitutes a
> "chunk" of this document. So the document is not complete
> until the
> connection is torn down. Traditional XML parsers choke in this
> situation, in that they cannot parse an incomplete
> document, or block
> waiting for the InputStream to send more data.
>
> I'm using a non-blocking network framework (Netty), so the notion of
> blocking until more data arrives isn't going to fly.
>
> I see that XOM supports the notion of accessing a document while it is
> still being built. I'm a bit fuzzy on how that works, but
> it might solve my problem.
>
> Is there a way to use XOM to parse a document in a
> non-blocking fashion?

Keep in mind that XOM does not parse XML, but uses an XML parser to do that.
So while tree building part can (AFAIK) work in non-blocking fashion (since
it can already be done for SAX events, which from XOM perspective is
non-blocking), you first need to find a parser that can parse input fed to
it, instead of reading from input stream or reader.

The only Java XML parser that I know is capable of doing this is Aalto.
But it is bit work-in-progress, mostly since interest in non-blocking
features so far has been non-existent. :-)
(which is to say, its blocking version works well, but non-blocking part has
some work to do, mostly wrt defining official API for feeding input -- core
parsing actually works well and has been tested).

If you are interest in details, please contact me off list, since its
off-topic for XOM -- I would be interested in finding a use case for
non-blocking parsing.
(this applies to others who might be interest in such async/non-blocking
parsing)

-+ Tatu +-








Archive powered by MHonArc 2.6.24.

Top of Page