src/main/java/com/rockagen/commons/util/XmlUtil.java
public static <T> String toXml(T obj, XAlias[] xAlias,
                                   XAliasField[] xAliasFields, XAliasAttribute[] xAliasAttributes,
                                   XOmitField[] xOmitFields,
                                   XImplicitCollection[] xImplicitCollection,
                                   XImmutableType[] xImmutableTypes, XConverter[] xConverters) {
        return (String) parse(0, XStream.NO_REFERENCES, obj, xAlias,
                xAliasFields, xAliasAttributes, xOmitFields,
                xImplicitCollection, xImmutableTypes, xConverters);
    }
public static <T> String toXml(T obj, XAlias[] xAlias,
                                   XAliasField[] xAliasFields, XAliasAttribute[] xAliasAttributes,
                                   XOmitField[] xOmitFields,
                                   XImplicitCollection[] xImplicitCollection,
                                   XImmutableType[] xImmutableTypes, XConverter[] xConverters) {
        return (String) parse(0, XStream.NO_REFERENCES, obj, xAlias,
                xAliasFields, xAliasAttributes, xOmitFields,
                xImplicitCollection, xImmutableTypes, xConverters);
    }
public static < T > String toXml ( T obj , XAlias [ ] xAlias , XAliasField [ ] xAliasFields , XAliasAttribute [ ] xAliasAttributes , XOmitField [ ] xOmitFields , XImplicitCollection [ ] xImplicitCollection , XImmutableType [ ] xImmutableTypes , XConverter [ ] xConverters ) { return ( String ) parse ( 0 , XStream . NO_REFERENCES , obj , xAlias , xAliasFields , xAliasAttributes , xOmitFields , xImplicitCollection , xImmutableTypes , xConverters ) ; }
Bean to xml.
<p>
Using XStream library from serialize objects to XML.
</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,
toXml(bean,xa,xaf,xaa,xf,xic,xit,xc);
</pre><b>Note: XStream Mode is {@link XStream#NO_REFERENCES}</b>

@param obj                 bean
@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
@param <T>                 obj
@return xml String
@since XSTREAM 1.4.5
Bean to xml . <p > Using XStream library from serialize objects to XML . < / 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 toXml ( bean xa xaf xaa xf xic xit xc ) ; < / pre > <b > Note : XStream Mode is { @link XStream#NO_REFERENCES } < / b >