I've had some luck getting this to work by implementing an OMDataSource that
doesn't start writing XML until it is passed a writer and then using it to
create an OMSourcedElementImpl.  It sort of depends on the semantics of what
you are doing, and you have to be careful as to what methods get called on
the OMSourcedElementImpl (it doesn't seem to take much to cause the whole
thing to inflate - try to avoid doing anything that causes the getReader()
method to get called before you are ready to start sending stuff out the
door), but we've managed to get true streaming to work using Axis2/Axiom,
which saves a lot of transient memory.

-----Original Message-----
From: Tammy Dugan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 15, 2007 7:03 AM
To: [email protected]
Subject: Re: [AXIOM] How to serialize axiom document without building
objects in memory

Before we started looking at axiom, we created a class called StringDom 
that extends the w3c dom classes. Each time an appendChild is called, 
this dom implementation writes the child to an outputstream/writer. That 
way, when we are building a large dom, the elements are not actually 
stored in memory but are directly flushed to the outputstream/writer. Of 
course, the disadvantage of this technique is that the dom elements must 
be appended in the exact order they will be written to output. My 
question is whether axiom allows the same kind of absolutely direct 
serialization when a child is appended to a parent? If so, how do I do it?

Thanks,

Tammy

Punnoose, Roshan wrote:
> Tammy, 
>
> I'm not exactly sure what you are trying to do... But the
> serialzeAndConsume(...) should not hold it the element in memory.
>
> Check the implementation of the Writer, and also check if the
> serialize(...) method will work.
>
> If none of this works, then what version of axis/axiom are you using?
>
> Roshan Punnoose
> Phone: 301-497-6039
>
> -----Original Message-----
> From: Tammy Dugan [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 14, 2007 2:55 PM
> To: [email protected]
> Subject: [AXIOM] How to serialize axiom document without building
> objects in memory
>
> I have the following code:
>
> new Thread(new ReadDeferred(writer, (OMElement) 
> returnData.createRawDataOutputFromTable(doc,
>             inputDatasetId,
>             outputDatasetId, type, false)
>                )).start();
>         ;
>         writer.close();
>
> class ReadDeferred
>     implements Runnable
> {
>     Writer writer = null;
>     OMElement topElement = null;
>     public ReadDeferred(Writer writer, OMElement topElement)
>     {
>         this.writer = writer;
>         this.topElement = topElement;
>     }
>
>     public void run()
>     {
>         try
>         {
>             topElement.serializeAndConsume(writer);
>         }
>         catch (Exception ex)
>         {
>             InitializationServlet.error("", ex);
>         }
>     }
> }
>
>
> I am trying to flush the output of createRawDataOutputFromTable directly
>
> to a file without creating a dom tree. The createRawDataOutputFromTable 
> method builds an OMDocument using a series of append child statements. 
> The above code still holds the whole dom tree in memory before it writes
>
> to a file. Is there a way I can prevent this? I essentially want every 
> appendChild to write the child to the file.
>
>
> Tammy
>
>   
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Tammy Dugan
Computer Programmer

Regenstrief Institute, Inc.
1050 Wishard Blvd., RG5
Indianapolis, IN 46202

(317) 630 - 7346

Confidentiality Notice: The contents of this message and any files
transmitted with it may contain confidential and/or privileged information
and are intended solely for the use of the named addressee(s). Additionally,
the information contained herein may have been disclosed to you from medical
records with confidentiality protected by federal and state laws. Federal
regulations and State laws prohibit you from making further disclosure of
such information without the specific written consent of the person to whom
the information pertains or as otherwise permitted by such regulations. A
general authorization for the release of medical or other information is not
sufficient for this purpose.
 
If you have received this message in error, please notify the sender by
return e-mail and delete the original message. Any retention, disclosure,
copying, distribution or use of this information by anyone other than the
intended recipient is strictly prohibited.



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




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

Reply via email to