My xml tree contains this in the structure
data1
da
EDITED
Using your updated XML, this code gives me "data2" and "data2" as output:
Sub Tester3()
Dim xmlDoc As New MSXML2.DOMDocument30
Dim objNodes As IXMLDOMNodeList, o As Object
xmlDoc.async = False
xmlDoc.LoadXML Range("C1").Value
xmlDoc.setProperty "SelectionLanguage", "XPath"
'### this takes care of the namespace ###
xmlDoc.setProperty "SelectionNamespaces", _
"xmlns:xx='uri:mybikes:wheels'"
If xmlDoc.parseError.errorCode <> 0 Then
MsgBox "Error!" & vbCrLf & _
" Line: " & xmlDoc.parseError.Line & vbCrLf & _
" Text:" & xmlDoc.parseError.srcText & vbCrLf & _
" Reason: " & xmlDoc.parseError.reason
Else
'### note: adding the namespace alias prefix defined above ###
Set objNodes = xmlDoc.SelectNodes("//xx:foo[@name='bar']/xx:location[@order='2']")
If objNodes.Length = 0 Then
Debug.Print "not found"
Else
For Each o In objNodes
Debug.Print o.nodeTypedValue
Next o
End If 'have line items
End If 'parsed OK
End Sub
Similar Q previously: How to ignore a XML namespace