xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Peter Stibrany <pstibrany AT gmail.com>
- To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Streaming Serializer
- Date: Wed, 14 Apr 2010 07:44:44 +0200
I use XML streaming when sending results while result are still being
computed. This computation takes some time and can produce lot of
results, but as soon as few results are available, I start streaming
them to the client, and client can then show it in the UI. Both client
and server use XOM. Server simply sends root element and then element
(with mixed content) for each result. Client uses own NodeFactory
subclass to parse and "report" partial results to the upper layer. It
works very well on both sides. Server doesn't need to keep results in
the memory, and for client it isn't all-or-nothing.
As for API, simple writeXMLDeclaration, writeStartTag/writeEndTag (for
root element), write(Element) and flush() worked fine for me.
I had bigger problems with NodeFactory which has only
startMakingElement(String name, String namespace) -- at this point,
attributes are not yet known, and finishMakingElement(Element element)
-- at this point, entire element content is built. My code needed to
react to attributes in root element, but at no point do you get element
with attributes only, without building entire element content.
-Peter
On 14. 4. 2010 0:15, Ian Phillips wrote:
> Haven't really given this much thought, but off the top of my head…
>
>
>> I never really planned for streaming serialization because I didn't
>> think it was very useful. However people seem to keep asking for it,
>> so maybe it's time to think about this.
>>
> Maybe like this:
>
> serializer.startDocument("rootElement name")
> for (int i = 0; i < 1000000000; ++i) {
> serializer.write(createNodeWithRandomContent());
> }
> serializer.endDocument()
>
> ?
>
> Or maybe with something that has an efficient (== small) in memory
> representation but an inefficient (== defined by an external standard) XML
> representation?
>
> I'm not sure, but I can think of examples where it would be useful.
>
> Also, perhaps, writing out the contents of a DB (embedded or otherwise) to
> disk in XML format - what happens if the DB is fairly large?
>
> Cheers,
> Ian.
>
> #ifndef __COMMON_SENSE__ | Ian Phillips
> #include <std_disclaimer> | ianp AT ianp.org
> #endif | http://ianp.org/
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>
-
[XOM-interest] Streaming Serializer,
Bruno Oliveira, 04/12/2010
- Re: [XOM-interest] Streaming Serializer, Kevin S. Clarke, 04/12/2010
-
Re: [XOM-interest] Streaming Serializer,
Elliotte Rusty Harold, 04/13/2010
-
Re: [XOM-interest] Streaming Serializer,
Ian Phillips, 04/13/2010
-
Re: [XOM-interest] Streaming Serializer,
Peter Stibrany, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Asgeir Frimannsson, 04/14/2010
- Re: [XOM-interest] Streaming Serializer, Peter Stibrany, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Asgeir Frimannsson, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Peter Stibrany, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Ian Phillips, 04/13/2010
Archive powered by MHonArc 2.6.24.