protected static String serializeDOMSource(DOMSource domSource){
  try {
    StringWriter writer=new StringWriter();
    StreamResult result=new StreamResult(writer);
    TransformerFactory tf=TransformerFactory.newInstance();
    Transformer transformer=tf.newTransformer();
    transformer.setOutputProperty(OutputKeys.ENCODING,DEFAULT_ENCODING);
    transformer.setOutputProperty(OutputKeys.INDENT,DEFAULT_INDENT);
    transformer.transform(domSource,result);
    writer.flush();
    return writer.toString();
  }
 catch (  Throwable e) {
    log.log(Level.SEVERE,"Failed to serialize node",e);
  }
  return null;
}

protected static String serializeDOMSource ( DOMSource domSource ) { try { StringWriter writer = new StringWriter ( ) ; StreamResult result = new StreamResult ( writer ) ; TransformerFactory tf = TransformerFactory . newInstance ( ) ; Transformer transformer = tf . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , DEFAULT_ENCODING ) ; transformer . setOutputProperty ( OutputKeys . INDENT , DEFAULT_INDENT ) ; transformer . transform ( domSource , result ) ; writer . flush ( ) ; return writer . toString ( ) ; } catch ( Throwable e ) { log . log ( Level . SEVERE , "Failed to serialize node" , e ) ; } return null ; }
this method serializes the supplied dom node to a string .
