Skip to Content.
Sympa Menu

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

xom-interest AT

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Eric Wang" <jemroc AT>
  • To: elharo AT
  • Cc: xom-interest <xom-interest AT>
  • 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:

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,

On Dec 19, 2007 7:05 AM, Elliotte Rusty Harold <elharo AT> 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
> Java I/O 2nd Edition Just Published!
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT

Archive powered by MHonArc 2.6.24.

Top of Page