Bonjour � tous,

j'ai un probl�me que je qualifierais de trivial; cependant je ne trouve pas la solution.

A chaque nouveau tour de boucle je d�sire cr�er un nouveau fichier XML avec des donn�es diff�rentes.

Cependant, le nouveau fichier cr�� garde en m�moire les anciennes donn�es et ainsi de suite.

Voici le code en question. Et merci d'avance de votre aide.

Bien � vous,

KM.

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
if(choixEtapeDeDemarrageDeScenario->ItemIndex)
{
    //create the xml to correspond of a step of the prodcution//
    // TiXmlDocument etapeIntermediaire;
 
    for(size_t i =  choixEtapeDeDemarrageDeScenario->ItemIndex ; i < choixEtapeDeDemarrageDeScenario->Items->Count ; i++)
    {
        //yze//
 
        //create the xml to correspond of a step of the prodcution//
        TiXmlDocument * etapeIntermediaire = new TiXmlDocument;
        TiXmlDeclaration * stepOfScnenario = new TiXmlDeclaration("1.0", "ISO-8859-1", "yes");
        etapeIntermediaire->LinkEndChild(stepOfScnenario);
        TiXmlElement * root = etapeIntermediaire->RootElement();
        const char * conf = "CONFIG";
        TiXmlElement * config = new TiXmlElement(conf);
        etapeIntermediaire->LinkEndChild(config);
        TiXmlElement * scne = new TiXmlElement("SCENARIO");
        config->LinkEndChild(scne);
 
        scne->SetAttribute("ID", AnsiString(PathManager::stepValueIDTemp[choixEtapeDeDemarrageDeScenario->ItemIndex]).c_str());
 
        TiXmlElement * duration = new TiXmlElement("DUREE");
        scne->LinkEndChild(duration);
 
        for(size_t i =  choixEtapeDeDemarrageDeScenario->ItemIndex ; i < PathManager::stepValueIDTemp.size() ; i++)
        {
            if(strcmp(AnsiString(PathManager::stepValueOfScnenario[i]).c_str(), "#N/A") != 0)
            {
                 //on y ajoute les scénarios/étapes correspondantes//
                 TiXmlElement * bloc = new  TiXmlElement("BLOC");
                 duration->LinkEndChild(bloc);
                 bloc->SetAttribute("NOM",  AnsiString(PathManager::stepValueOfScnenario[i]).c_str());
            }
        }
 
        /*std::string numberOfile;
        std::ostringstream ss;
        ss << counter;
        numberOfile = ss.str();  */
        /*std::string test = "test";
        std::string fileName = test ;// +  numberOfile;
        std::string FileName = fileName + ".xml"; */
        etapeIntermediaire->SaveFile(FileName.c_str());
        delete etapeIntermediaire;
    }
 
}