[XOM-interest] Writing large XML documents

Benson Margulies bim2007 at basistech.com
Mon Dec 17 23:02:19 EST 2007


In my travels, which are what they are, people who want to stream large volumes use StaX, not XOM. I recommend reading the XOM source or waiting to see if ERH corrects me.
 

-----Original Message-----
From: Eric Wang [mailto:jemroc at gmail.com] 
Sent: Monday, December 17, 2007 11:00 PM
To: Benson Margulies
Cc: xom-interest
Subject: Re: [XOM-interest] Writing large XML documents

Hi Benson, I understand that XOM is about trees, but it also provides a streaming API for reading large XML documents. I'm currently using that API in my application and figured it would have the complementary ability to write large documents as well.

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?


On Dec 17, 2007 10:48 PM, Benson Margulies <bim2007 at basistech.com> wrote:
> XOM is all about trees. If you don't want trees, don't use XOM at all. Google StaX.
>
>
> -----Original Message-----
> From: xom-interest-bounces at lists.ibiblio.org 
> [mailto:xom-interest-bounces at lists.ibiblio.org] On Behalf Of Eric Wang
> Sent: Monday, December 17, 2007 10:46 PM
> To: Tatu Saloranta
> Cc: xom-interest
> Subject: Re: [XOM-interest] Writing large XML documents
>
> No, it isn't necessary for me to build a tree model. Forgive my ignorance, but I can't find any mention of the SAX or Stax writers in the XOM documentation. Does this require an additional library?
>
>
> On Dec 17, 2007 10:36 PM, Tatu Saloranta <cowtowncoder at yahoo.com> wrote:
> > --- Eric Wang <jemroc at gmail.com> wrote:
> >
> > > Hi, I am attempting to write an XML file larger than available 
> > > memory.
> > > Looking over the tutorial, the section describing the toXML() 
> > > method states "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."
> >
> > Is it necessary for you to build an intermediate tree model? If not, 
> > you could just use SAX or Stax writers directly to produce xml 
> > content of unlimited length, with minimal buffering.
> >
> > -+ Tatu +-
> >
> >
> >
> >
> > ____________________________________________________________________
> > __ ______________ Never miss a thing.  Make Yahoo your home page.
> > http://www.yahoo.com/r/hs
> >
> _______________________________________________
> XOM-interest mailing list
> XOM-interest at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>


More information about the XOM-interest mailing list