src/main/java/com/rockagen/commons/util/XmlUtil.java
public static <T> String toXml(T obj, XAlias[] xAlias,
                                   XAliasField[] xAliasFields, XAliasAttribute[] xAliasAttributes,
                                   XOmitField[] xOmitFields) {

        return toXml(obj, xAlias, xAliasFields, xAliasAttributes, xOmitFields,
                null, null, null);
    }
public static <T> String toXml(T obj, XAlias[] xAlias,
                                   XAliasField[] xAliasFields, XAliasAttribute[] xAliasAttributes,
                                   XOmitField[] xOmitFields) {

        return toXml(obj, xAlias, xAliasFields, xAliasAttributes, xOmitFields,
                null, null, null);
    }
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")}

then,
toXml(bean,xa,xaf,xaa,xf);
</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 <T>              obj
@return xml String
@since XSTREAM 1.4.5