Hello,

Is anyone aware of a way to write an XML document, using XMLBeans, without
materializing the entire document in memory?  Perhaps using a companion API
such as XStream or StAX?

Our application communicates with other apps via XML messages.  We've
written schemas to define the messages, and used XMLBeans to generate java
classes for manipulation of that data on the way in and out.  Now we've
encountered a need to send very large messages, which is causing memory
problems since we must first construct the entire XMLBeans document before
calling save().

I'm aware that I can manipulate the XmlOptions so that I can write the
elements out bit by bit, i.e. I can write code such as:

write A open tag
write B open tag
write B simple element B1
write B simple element B2
write B close tag
write A simple element A1
write A close tag

I'll get:

<A><B><B1><B2></B></A1></A>

But...I'll have hard coded the knowledge of the order in which the elements
appear in the schema.  I don't want to do that, since that is the value
provided by XmlBeans' save() method - it writes things appropriately
according to the schema.

I'm considering writing my own implementation of this, so that as I assemble
the document, elements are written to disk 'on-the-fly' as appropriate, and
pruned from memory when their close tag is written.  However, before I
trudge down that road, I'd like to know if I'm reinventing the wheel.

Has anyone got any ideas?

Thanks a lot,

Brian
 

**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to