/*
 * $Id$
 *
 * [ Description ]
 * 
 */

#include "Behavioural/include/XML.h"
#include <fstream>
using namespace std;

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "XML::generate_file"
  void XML::generate_file (string encoding)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    header (encoding);

    string name     = _name;
    string filename =  name + "." + _filename_extension;

    cout << "Generate file \""<< filename << "\"" << endl;

    ofstream file;
    file.open(filename.c_str(),ios::out | ios::trunc);

    file << get_body();

    file.close();

    log_printf(FUNC,Behavioural,FUNCTION,"End");
  };

  void XML::generate_file (void)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    generate_file("UTF-8");
    log_printf(FUNC,Behavioural,FUNCTION,"End");
  };

}; // end namespace behavioural          
}; // end namespace morpheo              
