question: public static String fromDoc2String ( Document doc ) throws Exception { KXmlSerializer serializer = new KXmlSerializer ( ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; DataOutputStream dos = new DataOutputStream ( bos ) ; try { serializer . setFeature ( "http://xmlpull.org/v1/doc/features.html#indent-output" , true ) ; serializer . setOutput ( dos , XformConstants . DEFAULT_CHARACTER_ENCODING ) ; doc . write ( serializer ) ; serializer . flush ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } return new String ( bos . toByteArray ( ) , XformConstants . DEFAULT_CHARACTER_ENCODING ) ; }
target:  Converts an xml document to a string.