Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Writing large XML documents

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Eric Wang" <jemroc AT gmail.com>
  • To: elharo AT metalab.unc.edu
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Writing large XML documents
  • Date: Wed, 19 Dec 2007 18:28:51 -0500

Thank you for clearing this up for me Elliotte. I admit I was a bit
confused by that line in the documentation.

I was researching other solutions and stumbled upon Nux which builds
streaming serialization on top of XOM:
http://dsd.lbl.gov/nux/api/nux/xom/io/StreamingSerializer.html

Hopefully that helps someone out who has the same problem I do. It
would be nice to see this built-in into XOM though, to avoid
introducing another dependency. XOM already reads large and small
documents and writes small documents. The only thing missing from that
matrix is the capability to write large documents. Is this something
you would consider adding to XOM? Sorry if this proposal has already
been suggested before and rejected.

Thanks again,
Eric


On Dec 19, 2007 7:05 AM, Elliotte Rusty Harold <elharo AT metalab.unc.edu> wrote:
> Eric Wang wrote:
> >
> > This sentence in the documentation hints at such a capability using
> > the Serializer class: "However, since this builds the entire document
> > in memory, it can be problematic for large documents and less
> > efficient than using a Serializer, which can stream the document." I
> > just can't figure out how it would work looking at the documentation.
> > So is the documentation wrong in this respect?
> >
> >
>
> The Document object is still in memory in both cases. However in the
> toXML case there's also a large String that's also built in memory. With
> the Serializer, there's no single large string in memory.
>
> It's likely not a huge distinction: probably O(4N) for the Serializer
> and O(5N) for toXML where N is the size of the serialized document.
>
> A much more important reason for using Serializer is that it starts
> sending the document immediately. toXML waits until it's built the
> entire string.
>
> --
> Elliotte Rusty Harold elharo AT metalab.unc.edu
> Java I/O 2nd Edition Just Published!
> http://www.cafeaulait.org/books/javaio2/
> http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>




Archive powered by MHonArc 2.6.24.

Top of Page