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
| Option Explicit
Sub LecTureXML()
Dim oXML As New MSXML2.DOMDocument
Dim stFicXML As String
stFicXML = "D:\tmp\Monxml.xml"
oXML.async = False
Dim oNodeRow As IXMLDOMElement
Dim oNode As IXMLDOMElement
Dim oAttribut As IXMLDOMAttribute
If oXML.Load(stFicXML) Then
Set oNodeRow = oXML.selectSingleNode("/Fichier/Row[@Id='1']") 'Ce positionne sur le noeud 1..
For Each oNode In oNodeRow.childNodes
For Each oAttribut In oNode.Attributes
Debug.Print oAttribut.Name & " = " & oAttribut.Value & "/";
Next
Debug.Print
Next
Else
MsgBox "Erreur ouverture fichier xml :" & Dir(stFicXML)
End If
End Sub |