John-

Just to add some strength to Ralf's claim, I can say pretty
confidently all the objects are created in memory at unmarshal time. 
By default Castor creates a SAX2 parser (usually Xerces), and
registers itself as the appropriate event listeners.  Then, as the
parser fires start element events, Castor finds the ClassDescriptor
associated with the XML element and creates the object.  It then
continues to parse the child elements and populate the parent object's
fields with the newly created child objects.

(Thinking out loud now...) Lazy loading might be an interesting
concept, though applications that lend themselves to that processing
may do better in the JDO world of Castor.  If the whole point is to
save memory, we wouldn't want to create the DOM tree and unmarshal
objects on demand, so we'd want some kind of XPath/XQuery
implementation that would allow quick small slices of the file to be
extracted on demand and unmarshalled...  That would be cool, and it is
quickly approaching something like eXist (really start to see the
synergies between JDO and XML there).

In anycase, if this is a feature you're interested in, you can always
create an enhancement request at
http://jira.codehaus.org/browse/CASTOR

Let us know if you have any more questions.

Stephen


On 3/2/06, Ralf Joachim <[EMAIL PROTECTED]> wrote:
> Hi John,
>
> as far as I know the XML side of Castor it loades the whole document
> into memory at once. There are possibilities to unmarshal a document
> step by step but this requires some extra work from your side.
>
> Regards
> Ralf
>
>
> Childress, John (MLCI) schrieb:
> > Dumb question, I'm been using Castor for about four years now, love it.
> > A team member asked me if Castor "lazy loads" the xml?  Does it load the
> > document into memory when it's first marshaled?  Or only when a specific
> > "element" is first referenced?
> >
> > Thanks,
> >
> > John
> >
> > John Childress
> > (713) 544-5946 (work)
> > (832) 309-7358 (cell)
> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >
> > ------------------------------------------------------------------------
> > If you are not an intended recipient of this e-mail, please notify the
> > sender, delete it and do not read, act upon, print, disclose, copy,
> > retain or redistribute it. Click here
> > <http://www.ml.com/email_terms/>for important additional terms relating
> > to this e-mail.     http://www.ml.com/email_terms/
> > ------------------------------------------------------------------------
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>

Reply via email to