Hello All,
I'm a novice in VBScript and XML coding.However, getting my head around and going through online forums and blogs
I want to read/parse an xml file using VBScript,my XML file is not data but xml source code from an application.
Below is the code snippet that I'm using -
Sub LoadXMLFile()
Dim objXML 'for xml document
Dim objNode 'for xml node item
Dim i As Integer
i = 0
Set objXML = CreateObject("Microsoft.XMLDOM")
objXML.Load ("C:\path\test.xml")
objXML.setProperty "SelectionLanguage", "XPath"
Set objNode = objXML.SelectNodes("/report/queries/query/selection/dataItem/text()")
'MsgBox objNode.Text
For i = 0 To (objNode.Length - 1)
NodeVal = objNode(i).NodeValue
MsgBox NodeVal
Next
End Sub
When I step through the VB code the objNode.Length value always evaluates to 0. Not sure why its not calculating the Length.
Appreciate your time and response.
Thanks & Regards
Raj
I'm a novice in VBScript and XML coding.However, getting my head around and going through online forums and blogs
I want to read/parse an xml file using VBScript,my XML file is not data but xml source code from an application.
Below is the code snippet that I'm using -
Sub LoadXMLFile()
Dim objXML 'for xml document
Dim objNode 'for xml node item
Dim i As Integer
i = 0
Set objXML = CreateObject("Microsoft.XMLDOM")
objXML.Load ("C:\path\test.xml")
objXML.setProperty "SelectionLanguage", "XPath"
Set objNode = objXML.SelectNodes("/report/queries/query/selection/dataItem/text()")
'MsgBox objNode.Text
For i = 0 To (objNode.Length - 1)
NodeVal = objNode(i).NodeValue
MsgBox NodeVal
Next
End Sub
When I step through the VB code the objNode.Length value always evaluates to 0. Not sure why its not calculating the Length.
Appreciate your time and response.
Thanks & Regards
Raj