Bonjour à tous,
J'ai un petit problème qui, je pense, ne vous posera pas trop de problèmes, mais malheureusement je bloque moi !
En fait je veux avoir ce genre de XML à la fin en gros (je l'ai allégé) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<root>
  <section id="Test" description="Portail">
    <log description="D051DE6.jpg">Error : Unable to run - 22/06/2009 15:24:40</log>
    <log description="E4051E3B.jpg">Error : Exception - 22/06/2009 15:26:21</log>
  </section>
  <section id="Test" description="Portail">
    <log description="D70513F2.jpg">Error : EXI-GESDOS-0008_Connexion - 29/05/2009 15:55:13</log>
  </section>
  <section id="Test" description="Portail">
    <log description="Pas de screenshots dans ce log">Pas d'erreurs dans ce log</log>
  </section>
</root>
Donc chaque section contiennent plusieurs "log" avec un screenshot en description.

Mon code est celui-ci, mais le problème, c'est les 2 for-each donc il place deux fois les mêmes screenshot (.jpg) :
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
 
while (EName.MoveNext() && EErrors.MoveNext() && EScreen.MoveNext())
{
    Xtw.WriteStartElement("section");
    Xtw.WriteAttributeString("id", "Test");
    Xtw.WriteAttributeString("description", EName.Current.ToString());
    Xtw.WriteAttributeString("presentation_level", "1");
    Xtw.WriteAttributeString("error_level", "2");
 
    EachErrors = EErrors.Current.ToString().Split('\n');
    EachScreen = EScreen.Current.ToString().Split('\n');
    foreach (String Err in EachErrors)
        foreach (String Scr in EachScreen)
        {
              Xtw.WriteStartElement("log");
              Xtw.WriteAttributeString("error_level", "0");
              Xtw.WriteAttributeString("description", Scr);
              Xtw.WriteString(Err);
              Xtw.WriteEndElement();
        }
 
    Xtw.WriteEndElement();
}
Y a-t-il une solution pour remplacer les deux foreach ? (Dites moi si ce n'est pas assez clair)

Merci beaucoup d'avance !