src/main/java/com/rockagen/commons/util/XmlUtil.java
private static Object parse(int parseMod, int mode, Object value,
                                XAlias[] xAlias, XAliasField[] xAliasFields,
                                XAliasAttribute[] xAliasAttributes, XOmitField[] xOmitFields,
                                XImplicitCollection[] xImplicitCollection,
                                XImmutableType[] xImmutableTypes, XConverter[] xConverters) {

        if (value == null) {
            return null;
        }
        if (value instanceof String) {
            if (value.equals("")) {
                return null;
            }
        }

        final XStream xstream = new XStream();
        xstream.setMode(mode);
        initXstream(xstream, xAlias, xAliasFields, xAliasAttributes,
                xOmitFields, xImplicitCollection, xImmutableTypes, xConverters);

        if (parseMod == 0) {
            return xstream.toXML(value);
        } else {
            return xstream.fromXML((String) value);
        }

    }
private static Object parse(int parseMod, int mode, Object value,
                                XAlias[] xAlias, XAliasField[] xAliasFields,
                                XAliasAttribute[] xAliasAttributes, XOmitField[] xOmitFields,
                                XImplicitCollection[] xImplicitCollection,
                                XImmutableType[] xImmutableTypes, XConverter[] xConverters) {

        if (value == null) {
            return null;
        }
        if (value instanceof String) {
            if (value.equals("")) {
                return null;
            }
        }

        final XStream xstream = new XStream();
        xstream.setMode(mode);
        initXstream(xstream, xAlias, xAliasFields, xAliasAttributes,
                xOmitFields, xImplicitCollection, xImmutableTypes, xConverters);

        if (parseMod == 0) {
            return xstream.toXML(value);
        } else {
            return xstream.fromXML((String) value);
        }

    }
private static Object parse ( int parseMod , int mode , Object value , XAlias [ ] xAlias , XAliasField [ ] xAliasFields , XAliasAttribute [ ] xAliasAttributes , XOmitField [ ] xOmitFields , XImplicitCollection [ ] xImplicitCollection , XImmutableType [ ] xImmutableTypes , XConverter [ ] xConverters ) { if ( value == null ) { return null ; } if ( value instanceof String ) { if ( value . equals ( "" ) ) { return null ; } } final XStream xstream = new XStream ( ) ; xstream . setMode ( mode ) ; initXstream ( xstream , xAlias , xAliasFields , xAliasAttributes , xOmitFields , xImplicitCollection , xImmutableTypes , xConverters ) ; if ( parseMod == 0 ) { return xstream . toXML ( value ) ; } else { return xstream . fromXML ( ( String ) value ) ; } }
Parser

@param parseMod            0 is toXml
@param mode                XStream.ID_REFERENCES or XStream.NO_REFERENCES
@param value               value
@param xAlias              {@link com.rockagen.commons.util.XmlUtil.XAlias}
@param xAliasFields        {@link com.rockagen.commons.util.XmlUtil.XAliasField}
@param xAliasAttributes    {@link com.rockagen.commons.util.XmlUtil.XAliasAttribute}
@param xOmitFields         {@link com.rockagen.commons.util.XmlUtil.XOmitField}
@param xImplicitCollection {@link com.rockagen.commons.util.XmlUtil.XImplicitCollection}
@param xImmutableTypes     {@link com.rockagen.commons.util.XmlUtil.XImmutableType}
@param xConverters         {@link com.rockagen.commons.util.XmlUtil.XConverter}
@return Object
Parser