You can disable the XML declaration by:

Marshaller m = new Marshaller(myWriter);
m.setMarshalAsDocument(false);

That will basically tell the Marshaller to treat the XML as a fragment
and not a complete document.

--Keith

> "Adrian G. Klingel" wrote:
> 
> I want to write a very large XML document containing tens of thousands
> of a single repeating element within a root element.  There's no way
> to do this by assembling everything into the root element and then
> marshalling the whole thing.
> 
> I could use a FileWriter to write the opening root element tag,
> marshal each of the repeating elements that I've returned from a
> database result set, and then use the FileWriter to write the close
> tag.
> 
> Unfortunately, the XML header
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> gets written upon every marshal.  Is there any way to suppress that?
> 
> I found a StreamedMarshaller class in the archive, but it seems like
> it may be overkill for what I'm trying to accomplish.
> 
> Any ideas would be appreciated, as I'm sure this is something commonly
> done.
> 
> Sincerely,
> 
> Adrian Klingel
> 
> 
> 
>     ---------------------------------------------------------------
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to