You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Windchime <w...@zahuta.com> on 2009/06/01 18:26:19 UTC

Writing without a DOM?

I have a relatively large number of objects that I would like to serialize
as XML.  However, I don't want to build a DOM.  Notably, a DOM for these
objects requires a lot of memory.  Is there another Xerces (SAX-ish?) way to
create the XML?

 

Thanks,

 

Windy

 

 

 

 


Re: Writing without a DOM?

Posted by Chris Simmons <cp...@decisionsoft.com>.
Windchime wrote:
>
> I have a relatively large number of objects that I would like to 
> serialize as XML. However, I don’t want to build a DOM. Notably, a DOM 
> for these objects requires a lot of memory. Is there another Xerces 
> (SAX-ish?) way to create the XML?
>

I'd recommend using XMLEventWriter or XMLStreamWriter. These API's are 
included in java 1.6 but you can get hold of them separately. The good 
thing about this is it abstracts away from what you're actually writing 
to. It can write to a stream or a DOM document or whatever. Being able 
to write to a DOM might still be useful (e.g. in tests).

Chris Simmons.

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Writing without a DOM?

Posted by ke...@us.ibm.com.
Xerces supports SAX.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Writing without a DOM?

Posted by Jacob Kjome <ho...@visi.com>.
Have you looked at XStream [1]?  It's not an Apache project, but it is open 
source.

[1] http://xstream.codehaus.org/

Jake


On Mon, 1 Jun 2009 09:26:19 -0700
  "Windchime" <w...@zahuta.com> wrote:
> I have a relatively large number of objects that I would like to serialize
> as XML.  However, I don't want to build a DOM.  Notably, a DOM for these
> objects requires a lot of memory.  Is there another Xerces (SAX-ish?) way to
> create the XML?
> 
> 
> 
> Thanks,
> 
> 
> 
> Windy
> 
> 
> 
> 
> 
> 
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Writing without a DOM?

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
The JAXP TransformerHandler [1] can be used to serialize a document with
SAX events. Xalan and JDK 1.4+ supports this API.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/sax/TransformerHandler.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Windchime" <w...@zahuta.com> wrote on 06/01/2009 12:26:19 PM:

> I have a relatively large number of objects that I would like to
> serialize as XML.  However, I don?t want to build a DOM.  Notably, a
> DOM for these objects requires a lot of memory.  Is there another
> Xerces (SAX-ish?) way to create the XML?
>
> Thanks,
>
> Windy