I am working with Spring 3.2 and xstream to marshall/unmarshall XML and
have been running in circles trying to unmarshall annotated classes with
the same name/alias. The gist of it is that I want two separate packages to
contain similar models, with a spring configuration like this:

<bean id="xstreamMarshaller"
class="org.springframework.oxm.xstream.XStreamMarshaller">
    <property name="annotatedClasses">
        <list>
            <value>com.watchwith.Show</value>
            <value>com.watchwith.Content</value>
            <value>com.watchwith.alternate.Show</value>
            <value>com.watchwith.alternate.Content</value>
        </list>
    </property>
</bean>

In either "Show" and "Content" class I have the same aliases annotated:

@XStreamAlias("show")
public class Show {
    @XStreamAlias("content")
    private Content content;
...
}

@XStreamAlias("content")
public class Content {...}

And in my @Controllers I am importing the correct object, however, it seems
that xstream chooses one of the packages/aliases (possibly alphabetically?)
and always tries to unmarshall to that model. Is there a way (short of
distinct aliases) to advise xstream to which class the incoming XML should
be unmarshalled, since it does not appear to honor the value of the
@RequestBody annotation?

Thank you!

Ken Goudey
k...@watchwith.com

Reply via email to