* @return void
*/
public void saveFile (String docName, Document doc)
{
try {
FileAccess fileHandler = new FileAccess ();
OutputFormat format = new OutputFormat (doc, "ISO-8859-1" ,true);
format.setIndent (2);
format.setLineWidth (80);
format.setPreserveSpace (true);
StringWriter stringOut = new StringWriter ();
XMLSerializer serial = new XMLSerializer (stringOut, format);
serial.asDOMSerializer ();
serial.serialize (doc.getDocumentElement());
String filePath = this.dataDir + "/news/" + docName;
// Check if the directory structure exists...
fileHandler.createDocDir (docName,this.dataDir + "/news/");
// We need to delete the file before the write operation
File fd = new File (filePath);
if ( fd.exists() ) {
fd.delete();
}