Daniel-

Have you looked into the MarshalListener interface?  Looking at the
Marshaller code, the listener is notified before and after each
element is written to the output "stream" (term used loosely).  So
it's quite possible you can grab the <root attribute key=values> based
on the pre-marshal event on your first <a> element (not ideal, but
might be functional).

Let me know how it goes, this might be an interesting topic for a
Castor HOW-TO document.

Thanks,
Stephen


On 3/20/06, Daniel Nilsson <[EMAIL PROTECTED]> wrote:
>
>
> Hello!
> Does anyone have any idea how to solve this problem with the
> Castor-marshaller?
> I am loading data into Castor-generated Java objects and wants to
> marshall/write them to a stream, but I can't wait until the entire
> root-object is completely filled until writing.
>
> To try and explain lets say I have an XML looking like this
> <root attribute key=values>
>   <a>lots of data</a>
>   <a>lots of data</a>
>   <a>lots of data</a>
> </root>
>
> What I would like to do is to write the start-"root"-tag to the stream, and
> then when an "a"-elements is finished, write it to the stream.
> And finally when I am finished with all my "a"-elements, write the
> end-"root"-tag.
>
> Is there any methods like MarshallHelper.createStartTag(CastorObject obj)
> that would create/return the start-xml-tag?
> I have looked in the JavaDoc but cant't find anything like that....
>
> Best regards
> Daniel Nilsson
>
>
>
>

Reply via email to