Forum Discussion
XPath and name space
- Jun 12, 2019
Hi,
I recommend using setProperty Method.
Public Sub Sample()
With CreateObject("MSXML2.DOMDocument")
.async = False
If .Load("C:\Test\Test.xml") Then
.SetProperty "SelectionNamespaces", "xmlns:n1='http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader'"
Debug.Print .SelectNodes("//n1:Identifier").Item(0).XML
End If
End With
End Subref.
https://support.microsoft.com/en-us/help/288147/how-to-use-xpath-to-query-against-a-user-defined-default-namespaceBest regards,
kinuasa
Hi,
I recommend using setProperty Method.
Public Sub Sample()
With CreateObject("MSXML2.DOMDocument")
.async = False
If .Load("C:\Test\Test.xml") Then
.SetProperty "SelectionNamespaces", "xmlns:n1='http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader'"
Debug.Print .SelectNodes("//n1:Identifier").Item(0).XML
End If
End With
End Sub
ref.
https://support.microsoft.com/en-us/help/288147/how-to-use-xpath-to-query-against-a-user-defined-default-namespace
Best regards,
kinuasa