Am using DocumentBuilderFactory to read an XML file and write the same file with different file name. Here's my code :
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document dom = db.parse(new InputSource("internal.xml"));
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(dom);
StreamResult result = new StreamResult(new File("newInternal.xml"));
transformer.transform(source, result);
System.out.println("File Saved!!!");
But am experiencing error in 'newInternal.xml' file. It's saving with '<' , '>' in the new file. May I know the issue with the above code ? But it's working fine when I changed the Xml version from 1.1 to 1.0.