Tuesday, September 15, 2009

Get value in XML Node with XPath (Node Group)

Below code we can Get multiple values with Node path from XML file.
Set xmlDoc = CreateObject ( "Microsoft.XMLDOM")
xmlDoc.Async = "false" xmlDoc.Load ( "C:\Test1.xml")
i=0
For Each personneElement In xmlDoc.selectNodes ( "/Modules/Module/Options/Option/Skus/Sku/Price/AssociatedPrices/Price/AssociatedPrices/Price/Type")

If personneElement.text = "Expectedvalue" Then
MsgBox personneElement.text
' we can get Two previous node value with below statement
MsgBox personneElement.PreviousSibling.PreviousSibling.text
' personneElement. i= i+1
End If
Next
msgbox i

Reference :-
http://techdos.com/content/view/77/74/

No comments:

Post a Comment