This content has been marked as final. Show 1 reply
Welcome to the Sun forums.
1. Please post your code using code tags, this formats it so that it is easier for people to read and understand it. Click on 'CODE' above the text area when posting.
2. As far as possible, please post an SSCCE
3. Please explain what you are trying, what you're expecting and what you're getting. Don't expect to be spoon-fed the answer without putting in any work.
The very simplest way would be to simply write all the nodes yourself:
But this is pretty brittle and prone to errors and would only work for the most trivial files. If you want robust XML support then you should use some library like perhaps jdom
FileWriter writer = new FileWriter(new File("myXML.xml")); writer.write("<Parent_Folder>"); writer.write("<Sub_Folder>"); writer.write(subFolderFileObject.getName()); writer.write("</Sub_Folder>"); //etc