public static String print(Node node,String encoding){
  if (node == null) {
    return null;
  }
  try {
    TransformerFactory tFactory=TransformerFactory.newInstance();
    Transformer transformer=tFactory.newTransformer();
    transformer.setOutputProperty("omit-xml-declaration","yes");
    transformer.setOutputProperty("encoding",encoding);
    DOMSource source=new DOMSource(node);
    ByteArrayOutputStream os=new ByteArrayOutputStream(2000);
    StreamResult result=new StreamResult(os);
    transformer.transform(source,result);
    return os.toString(encoding);
  }
 catch (  Exception e) {
    return null;
  }
}

public static String print ( Node node , String encoding ) { if ( node == null ) { return null ; } try { TransformerFactory tFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = tFactory . newTransformer ( ) ; transformer . setOutputProperty ( "omit-xml-declaration" , "yes" ) ; transformer . setOutputProperty ( "encoding" , encoding ) ; DOMSource source = new DOMSource ( node ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( 2000 ) ; StreamResult result = new StreamResult ( os ) ; transformer . transform ( source , result ) ; return os . toString ( encoding ) ; } catch ( Exception e ) { return null ; } }
prints a node tree recursively .
