try like this
and the OutputCode:Private Sub Command1_Click() Dim xmlDoc As MSXML2.DOMDocument60 Dim currentRootElement As MSXML2.IXMLDOMElement Dim currentNodeElement As MSXML2.IXMLDOMNode ' Dim Temp As MSXML2.IXMLDOMNamedNodeMap Dim temp2 As MSXML2.IXMLDOMElement Set xmlDoc = New MSXML2.DOMDocument60 xmlDoc.async = False xmlDoc.Load ("E:\beic.xml") Set currentRootElement = xmlDoc.documentElement 'Traverse through all child For Each currentNodeElement In currentRootElement.childNodes Set Temp = currentNodeElement.Attributes If Temp.length > 0 Then Set temp2 = currentNodeElement Debug.Print "Mother Element Name = " & currentRootElement.nodeName & vbCrLf & "Child Element Name = " & currentNodeElement.nodeName & vbCrLf & "Company = " & temp2.getAttribute("company") Debug.Print "----------------------------------" End If Next Set xmlDoc = Nothing End Sub
hthCode:Mother Element Name = applications Child Element Name = app Company = Orange Inc. ---------------------------------- Mother Element Name = applications Child Element Name = app Company = Lemon Inc. ---------------------------------- Mother Element Name = applications Child Element Name = app Company = Lemon Inc. ----------------------------------




Reply With Quote
