On Fri, 2005-09-30 at 13:16 -0700, Eric Johnson wrote:
> Thanks for the response.
> 
> That seems weird, though.  That means if you call the serialize function 
> (without the cache), the OMDocument can effectively be corrupted.

Its a necessary feature .. that allows one to process headers and then
realize you need to forward the message on and go ahead and do that with
very little overhead.

> I found myself putting this comment on OMDocument.serialize()
> 
>      * <p>Caution: Serializing without caching means that any portion of 
> the document
>      * that has not been read will no longer be available for further 
> reading.
>      * In other words, this function can corrupt the remainder of your 
> <code>OMDocument</code>.
>      * Only use it when you're sure you know longer need the contents of 
> the document.</p>

Maybe a simple fix could be to s/serialize/serializeConsuming/ and
s/serializeWithCache/serialize/. 

> Should the function also somehow mark the document then, so that 
> OMDocumentImpl.buildNext() throws an exception?

+1.

Sanjiva.

Reply via email to