I am trying to use recursive technique to retrieve xml file. Can somebody help me doing that.
I am trying to read below xml, but not sure the depth of the nested tag
VBScript provides you with tools to parse and process XML structures:
Set xml = CreateObject("MSXML2.DOMDocument")
xml.async = False
xml.load "c:\path\to\foo.xml"
WScript.Echo xml.xml
You can access elements in the document tree using (among other things) the XPath query language:
Set nodes = xml.selectnodes("//TestStep[@TSName='TestStep 2']")
The above selects all TestStep nodes anywhere in the tree, which have an attribute TSName with a value TestStep 2.
Once you have the node(s) you can read or change their attributes:
WScript.Echo nodes.Length
WScript.Echo nodes(0).parentNode.nodeName
WScript.Echo nodes(1).parentNode.nodeName
WScript.Echo nodes(0).text
nodes(0).text = "foo"
WScript.Echo nodes(0).text
WScript.Echo xml.xml