Jump to the post that solved this thread.
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Expected End statement error
#1
Solved: 9 Years, 5 Months ago
Hi All
I am using the below code to retrieve data from xml file. I need to retrieve xml value for many nodes hence thought of passing the node path for xml from datasheet. But when I execute the code i'm getting "Expected End statement" error.

Please find the code below:

Code:
Datatable.ImportSheet "filepath", "sheetname", 1

Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False

XMLDataFile = "xmlFilepath"
xmlDoc.Load (XMLDataFile)

Set nodes = xmlDoc.SelectNodes Datatable.Value ("XML_Node") 'Here I'm passing "/ListOfOrder/Order/Id/text()" value in datasheet
    
msgbox "total count of id tag is " & nodes.length

For i = 0 To (nodes.Length - 1)

Id = nodes(i).NodeValue

Msgbox  "The name of Author is " & Id

Next

I am getting "Expected End statement" error in line:
Code:
Set nodes = xmlDoc.SelectNodes Datatable.Value ("XML_Node")

Pls help in resolving this
Reply
#2
Solved: 9 Years, 5 Months ago
Hi,

Replace the line

Code:
Set nodes = xmlDoc.SelectNodes Datatable.Value ("XML_Node")

with

Code:
Set nodes = xmlDoc.SelectNodes( Datatable.Value ("XML_Node",Global))

and replace the line

Code:
Id = nodes(i).NodeValue

with

Code:
Id = nodes(i).Text
Reply
#3
Solved: 9 Years, 5 Months ago
Hey Bhargava...... ur code worked out.....!!!
Thanks a Lottt Smile
Reply
Jump to the post that solved this thread.


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to check expected cookies are present or not priyanka.agarwal 0 2,016 07-02-2015, 12:43 PM
Last Post: priyanka.agarwal
  Validate Numeric value is displaying expected format kalaivanan123 1 3,521 09-23-2013, 08:45 PM
Last Post: ravi.gajul
  closing browser at end bistritapcv 3 6,269 04-12-2013, 07:21 AM
Last Post: basanth27
  QTP: code is not working as expected mahi392 0 2,244 09-17-2012, 10:56 PM
Last Post: mahi392
  expected ')' error sia sharma 8 5,923 08-30-2012, 04:30 PM
Last Post: sshukla12

Forum Jump:


Users browsing this thread: 1 Guest(s)