Bonjour,

j'essaye de créer un IDictionary(Key, Value) avec ce code :
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
 
        Dim DocumentXML As New XmlDocument()
        Dim i As Integer
        Dim Key As String
        Dim ParamsDictionary As IDictionary(Of String, String) = New Dictionary(Of String, String)
        Dim Tag As String()
        Dim TagBis As String
        Dim TagTransformation As String()
        Dim Value As String
 
        DocumentXML.Load("C:\test.xml")
        Tag = PrintParamRow.FIELD.Split(".")
 
       For Each PrintParamRow As dsPrintParams.PRINT_PARAMSRow In Me.PrintParams.dsBD.PRINT_PARAMS
         For Each ParentNode As XmlNode In DocumentXML
            For Each ChildNode As XmlNode In ParentNode.ChildNodes
                 If ChildNode.LocalName = Tag(Tag.GetLowerBound(0)) Then
                         For Each LittleChildNode As XmlNode In ChildNode.ChildNodes
                            If LittleChildNode.LocalName = Tag(Tag.GetUpperBound(0)) Then
                                Key = PrintParamRow.BOOKMARK
                                Value = LittleChildNode.InnerText
                                ParamsDictionary.Add(Key, Value)
                            End If
                        Next
                    End If
            Next
        Next
    Next
    End Function
Et voici, un petit tableau pour une explication plus claire
TAG est une balise dans le fichier xml que j'obtiens en prenant la partie droite du FIELD, ensuite j'ajoute le BOOKMARK comme clé et la valeur de TAG dans Valeur
TAG BOOKMARK FIELD

OBJET OBJET DOSSIER.OBJET
DATE_DEMANDE DATEDEMANDE DOSSIER.DATE_DEMANDE
DATE_AR DATEAR DOSSIER.DATE_AR
AVISPREALABLE AVISPREALABLE DOSSIER.AVISPREALABLE
ENQUETE PUBLICITE DOSSIER.ENQUETE
ID AVIS SERVCOM.ID
ID IDDOSSIER DOSSIER.IDDOSSIER
Tout se passe bien jusqu'à la dernière ligne où ça boucle plusieurs fois dessus et me met l'erreur
Un élèment avec la même clé à déja été ajouté
De où peut provenir le problème ?