Bonjour,

Alors voila je narrive pas a ajouter plus d`un noeud dans un fichier xml qui s´execute dans une boucle.

Un test bete que j´ai essaye !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
For i = 1 To 1000
      WriteXmlDoc()
Next
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
 
Private Sub WriteXmlDoc(ByRef i As Integer)
 
        Dim rootNode As XmlElement
        Dim NodeDatabase as XmlElement
 
        Try
            rootNode = XmlDoc.CreateElement("Clients")
            XmlDoc.LoadXml("<Diff></Diff>")
 
            'head
            NodeDatabase = XmlDoc.CreateElement("Software")
 
            NodeDatabase.InnerText = CStr(i)
 
            'attach all the child nodes to the root node
            rootNode.AppendChild(NodeDatabase)
 
            XmlDoc.DocumentElement.AppendChild(rootNode)
            XmlDoc.Save("Newsite.XML")
 
        Catch ex As Exception
            LogFactory.getInstance().logError(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Cannot create XML document", ex)
        End Try
 
    End Sub

Le truc le plus bete du monde jarrive pas a ajouter de noeuds,il boucle 1000 fois et me reecrit 1000 fois 1 noeud

Quelle methode me permet de rajouter un ou plusieurs noeuds
Il existe pas une methode append comme pour les fichiers ??
Merci de votre aide,je deviens fou
Brice