src/main/java/com/rockagen/commons/util/XmlUtil.java
public static Object toBeanWithIdRef(String xmlStr, XAlias[] xAlias,
                                         XAliasField[] xAliasFields, XAliasAttribute[] xAliasAttributes,
                                         XOmitField[] xOmitFields,
                                         XImplicitCollection[] xImplicitCollection,
                                         XImmutableType[] xImmutableTypes, XConverter[] xConverters) {

        return parse(1, XStream.ID_REFERENCES, xmlStr, xAlias, xAliasFields,
                xAliasAttributes, xOmitFields, xImplicitCollection,
                xImmutableTypes, xConverters);
    }
public static Object toBeanWithIdRef(String xmlStr, XAlias[] xAlias,
                                         XAliasField[] xAliasFields, XAliasAttribute[] xAliasAttributes,
                                         XOmitField[] xOmitFields,
                                         XImplicitCollection[] xImplicitCollection,
                                         XImmutableType[] xImmutableTypes, XConverter[] xConverters) {

        return parse(1, XStream.ID_REFERENCES, xmlStr, xAlias, xAliasFields,
                xAliasAttributes, xOmitFields, xImplicitCollection,
                xImmutableTypes, xConverters);
    }
Bean to xml.
<p>
Using XStream library from xml to serialize objects.
</p>
example:
<pre>
XAlias[] xa={new XAlias("Foo",Foo.class)};
XAliasField[] xaf={new XAliasField("Bar",Bar.class,"bar")};
XAliasAttribute[] xaa={new XAliasAttribute("Name",User.class,"name")};
XOmitField[] xf={new XOmitField(V.class,"v")};
XImplicitCollection[] xic=null;
XImmutableType[] xit=null;
XConverter[] xc=null;
then,
toBean(xmlStr,xa,xaf,xaa,xf,xic,xit,xc);
</pre> <b>Note: XStream Mode is {@link XStream#ID_REFERENCES}</b>

@param xmlStr              xml String
xml String
@param xAlias              Alias a Class to a shorter name to be used in XML elements.
@param xAliasFields        Create an alias for a field name.
@param xAliasAttributes    Create an alias for an attribute.
@param xOmitFields         Prevents a field from being serialized.
@param xImplicitCollection Adds implicit collection which is used for all items of the
given element name defined by itemFieldName.
@param xImmutableTypes     Add immutable types. The value of the instances of these types
will always be written into the stream even if they appear
multiple times.
@param xConverters         register converter
@return Object
@since XSTREAM 1.4.5