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?
Here is my 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);
Here is a correct version of the code above: