title: How to save a large string into xml files in java?
body: <p>I loaded some large data as xml format into a string in my program (from mysql) and when I save this string into an out.xml, just about 500 record stored.
  How do I save a large string or other data into a file in xml format or any other format?</p>
  
  <p>Here is my Code :</p>
  
  <pre><code>    String xmlString = doExportIntoString();
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      InputSource source = new InputSource(new StringReader(xmlString));
      Document document =factory.newDocumentBuilder().parse(source);        
      TransformerFactory tf = TransformerFactory.newInstance();
      Transformer transformer = tf.newTransformer();
      Result result = new StreamResult(new File("C:\\xmlFile.xml"));
      Source s = new DOMSource(document);
      transformer.transform(s, result);
  </code></pre>