public static String document2String(Document document) throws MaryConfigurationException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  document2Stream(document,baos);
  try {
    return new String(baos.toByteArray(),"UTF-8");
  }
 catch (  UnsupportedEncodingException uee) {
    Log.d(Mary.LOG,"oops" + uee.toString());
    throw new MaryConfigurationException("oops",uee);
  }
}

public static String document2String ( Document document ) throws MaryConfigurationException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; document2Stream ( document , baos ) ; try { return new String ( baos . toByteArray ( ) , "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { Log . d ( Mary . LOG , "oops" + uee . toString ( ) ) ; throw new MaryConfigurationException ( "oops" , uee ) ; } }
write a dom document into a string .
