public static Object deSerialize(String xmlString) throws Exception {
  Class<?> xstreamClass;
  java.lang.reflect.Constructor<?> constructor;
  Object xstream;
  Class<?>[] deSerializeArgsClasses=new Class[1];
  Object[] deSerializeArgs=new Object[1];
  java.lang.reflect.Method methodDeSerialize;
  Object result;
  xstreamClass=Class.forName("com.thoughtworks.xstream.XStream");
  constructor=xstreamClass.getConstructor();
  xstream=constructor.newInstance();
  deSerializeArgsClasses[0]=String.class;
  deSerializeArgs[0]=xmlString;
  methodDeSerialize=xstreamClass.getMethod("fromXML",deSerializeArgsClasses);
  try {
    result=methodDeSerialize.invoke(xstream,deSerializeArgs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    result=null;
  }
  return result;
}

public static Object deSerialize ( String xmlString ) throws Exception { Class < ? > xstreamClass ; java . lang . reflect . Constructor < ? > constructor ; Object xstream ; Class < ? > [ ] deSerializeArgsClasses = new Class [ 1 ] ; Object [ ] deSerializeArgs = new Object [ 1 ] ; java . lang . reflect . Method methodDeSerialize ; Object result ; xstreamClass = Class . forName ( "com.thoughtworks.xstream.XStream" ) ; constructor = xstreamClass . getConstructor ( ) ; xstream = constructor . newInstance ( ) ; deSerializeArgsClasses [ 0 ] = String . class ; deSerializeArgs [ 0 ] = xmlString ; methodDeSerialize = xstreamClass . getMethod ( "fromXML" , deSerializeArgsClasses ) ; try { result = methodDeSerialize . invoke ( xstream , deSerializeArgs ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; result = null ; } return result ; }
deserializes an object from the supplied xml string
