Hi Brian,

We've been thinking of adding something on these lines to XMLBeans but I
couldn't find the time for it.

We've been thinking to use the pull parser model of Stax and to be able
to filter (custom or XPath) small pieces in and out of an XmlObject.
This should be working for both reading and writing of large messages.

This seems to be something that other users asked for, we should
consider adding it to the package.

Please let me if I can help you with more info on how XMLBeans work.

Cezar

> -----Original Message-----
> From: Hartin, Brian [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 15, 2006 4:42 PM
> To: 'user@xmlbeans.apache.org'
> Cc: Hartin, Brian
> Subject: Can I stream XMLBeans to disk in a way that saves memory?
> 
> 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]

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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

Reply via email to