public boolean createXML(StreamResult result){
  try {
    DOMSource source=new DOMSource(getDocument());
    TransformerFactory tFactory=TransformerFactory.newInstance();
    Transformer transformer=tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.ENCODING,"UTF8");
    transformer.setOutputProperty(OutputKeys.INDENT,"yes");
    transformer.transform(source,result);
  }
 catch (  Exception e) {
    log.log(Level.SEVERE,"(StreamResult)",e);
    return false;
  }
  return true;
}

public boolean createXML ( StreamResult result ) { try { DOMSource source = new DOMSource ( getDocument ( ) ) ; TransformerFactory tFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = tFactory . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "UTF8" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . transform ( source , result ) ; } catch ( Exception e ) { log . log ( Level . SEVERE , "(StreamResult)" , e ) ; return false ; } return true ; }
create xml representation to streamresult
