Bonjour,
j'ai un pb, j'ai fais au moins 5 fonctions qui permettent de trouver un "text" ou un "attibut" dans dans un ou des tags.. en fait je fait une fonction pour chaque profondeur, mais il n'y aurrai pas moyen de trouver ça direct de manière récusive? je sèche!
voici mon code:
si je veut un entier je refais la fonction... avec integer à la place, et si il y à trois enfants, encore une autre fonction... ya pas moyen?
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 Private Function cherche_text_return_char_2(TagName_1_ As String, TagName_2_ As String, text_ As String, num As Long) As String ' fonction renvoiant une chaine de caractères du fichier xml désigné par les trois balises données Dim Indice As Integer Dim taille As Integer Dim myStr As String Dim xmlElement As MSXML2.IXMLDOMElement Dim textNode As MSXML2.IXMLDOMElement Dim textNode_2 As MSXML2.IXMLDOMElement Dim textNode_3 As MSXML2.IXMLDOMElement Indice = 0 Set xmlElement = xmlDoc.documentElement For Each textNode In xmlElement.getElementsByTagName(TagName_1_) For Each textNode_2 In textNode.getElementsByTagName(TagName_2_) For Each textNode_3 In textNode.getElementsByTagName(text_) If Indice = num Then cherche_text_return_char_2 = textNode_3.Text GoTo fin_cherche_text_return_char_2 End If Indice = Indice + 1 Next Next Next fin_cherche_text_return_char_2: End Function
merci d'avance
Partager