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: "Tatu Saloranta" <cowtowncoder AT yahoo.com>
  • Cc: XOM interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Writing large XML documents
  • Date: Tue, 18 Dec 2007 00:35:53 -0500

On Dec 17, 2007 11:22 PM, Tatu Saloranta <cowtowncoder AT yahoo.com> wrote:

> That is bit misleading, in a way -- it's more accurate
> to say that you can build tree representations for
> sub-trees of xml content (and potentially also discard
> earlier parts, trim while you go, if you want to get
> fancy). Although underlying parsers are all streaming
> (XOM is not a parser but uses underlying parsers like
> Xerces), result is still a tree that has to completely
> fit in memory.

True, but I don't build a tree at all when processing large XML files.
I use a custom NodeFactory subclass and do all my processing in
finishMakingElement().

> If you don't read input (in this particular case) in
> as a XOM tree, there isn't much XOM can do for you.

I understand that the most common usage of XOM is for building trees,
but the documentation describes the custom NodeFactory technique
pretty well, which leads me to believe that that is also a valid use
case.

> Writing output using Stax is quite simple. One of
> oldest introductions was written by Elliotte:
>
> http://www.xml.com/pub/a/2003/09/17/stax.html
>
> and writer-side is briefly covered on second page.
>
> More recently, Sun has included Stax api as well as
> reference implementation with Java 1.6, tutorial can
> be found at:
>
> http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP.html
>
> Hope this helps,
>
> -+ Tatu +-

Thanks, the links do help. I'll look into them further if I can't get
XOM to do what I need. I'd like avoid introducing additional
dependencies if at all possible. XOM has worked well for me in reading
XML documents both large and small, so if there's a way to do
streaming serialization through XOM, I'd prefer to use it. Hopefully,
Elliotte can clear up the documentation issue I brought up.




Archive powered by MHonArc 2.6.24.

Top of Page