public String toXML(final XStream xstream,final Object obj) throws ObjectStreamException {
  final Writer writer=new StringWriter();
  try {
    toXML(xstream,obj,writer);
  }
 catch (  final ObjectStreamException e) {
    throw e;
  }
catch (  final IOException e) {
    throw new StreamException("Unexpected IO error from a StringWriter",e);
  }
  return writer.toString();
}

public String toXML ( final XStream xstream , final Object obj ) throws ObjectStreamException { final Writer writer = new StringWriter ( ) ; try { toXML ( xstream , obj , writer ) ; } catch ( final ObjectStreamException e ) { throw e ; } catch ( final IOException e ) { throw new StreamException ( "Unexpected IO error from a StringWriter" , e ) ; } return writer . toString ( ) ; }
serialize an object including the xstream to a pretty - printed xml string .
