Can I give smooks a partially filled model

View: New views
2 Messages — Rating Filter:   Alert me  

Can I give smooks a partially filled model

by Tom Masterson-2 :: Rate this Message:

| View Threaded | Show Only this Message

I am filling a java model from one or more xml documents.  Some of the
java model may be filled before the smooks xml conversion is done.  I
would like to be able to have smooks fill in the parts of the model where
the xml has data.  So far the only way I have figured to do this is to
have the smooks parsing return it's own model with the appropriate fields
filled in and then merge that with the model that has data in it.  Is
there a better way to do this?

Tom

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Can I give smooks a partially filled model

by TomFennelly :: Rate this Message:

| View Threaded | Show Only this Message

If I understand you properly, you're asking if there's a way to have
Smooks populate a Java model over multiple executions of Smooks.  If so
then the answer is "probably" yes... I know some people have done this
(Michael Mackey being one), but it may depend on your exact use case...  
so I have the "probably" caveat in there.

To do this, you need to set the java object model produced by the 1st
Smooks instance into the BeanContext that's passed to the second smooks
instance.  Then in the config of the second smooks instance, you need to
omit the createOnElement attribute for the objects that are already
created and passed into through the BeanContext.

On 13/06/2012 13:05, Tom Masterson wrote:

> I am filling a java model from one or more xml documents.  Some of the
> java model may be filled before the smooks xml conversion is done.  I
> would like to be able to have smooks fill in the parts of the model
> where the xml has data.  So far the only way I have figured to do this
> is to have the smooks parsing return it's own model with the
> appropriate fields filled in and then merge that with the model that
> has data in it.  Is there a better way to do this?
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email