Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need URGENT help how to read xml string / xml tag value in web page using QTP
#1
Not Solved
Hi,

I am navigating to a link which gives me xml data in web page (webXML)
I need to read the value of one of the node attribute
Please guide me how to read the xml string/xml tag value from web page in QTP
Thanks.
Reply
#2
Not Solved
You can use XML dom method to read the file.

Sample code:

Code:
Const XMLDataFile = "C:\TestData.xml"

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

' For setting the node

Set nodes = xmlDoc.SelectNodes("/bookstore/book") ' This is the nodes in the xml file
MsgBox "Total books: " & nodes.Length

Set nodes = xmlDoc.SelectNodes("/bookstore/book/title/text()")

' get their values
For i = 0 To (nodes.Length - 1)
    Title = nodes(i).NodeValue
    MsgBox "Title #" & (i + 1) & ": " & Title
Next
Reply
#3
Not Solved
Thanks for the reply.
But as I said I do not have any .xml file to read. I have one search URL which I have to hit in IE and the webpage displays me the the content in webpage that is actually a XML data. Following is the the content of the webpage which I have to read and extract the value for ''s:accessedDate"

Code:
<?xml version="1.0" encoding="UTF-8"?><dv:result xmlns:rss="http://........" xmlns:cl="http://xmlns......" xmlns:html="http://www......./xhtml" xmlns:time="http://xmlns......" xmlns:crx="http://www........"
xmlns:pjk="http://xmlns......." xmlns="" dv:parent="/s/s:preview/rs/" dv:self="/....:....../xyz000000011401" dv:count="3" dv:time="2"><xyz000000011401 s:isLineup="false" s:isRender="false" s:accessedDate="2009-04-10T14:46:43.993-04:00" s:id="00000000011401" s:name="ABC XYZ" s:modificationDate="2009-03-17T17:09:32.000-04:00" s:creationDate="2009-03-17T16:50:17.000-04:00" s:User="tem" s:modifiUser="ago" s:creatUser="ago" s:ctype_n="Re" s:ctype="rs:re" s:isChannelPage="false" jcr:primaryType="s:pub_citem" s:JobId="PREVIEW" s:ediStatus="EDIT_REVIEW" s:seoPath="creamy-shrimp-corn-bacon-00000000011401" dv:parent="/s/s:preview/rs/" dv:self="/s/s:preview/rs/xyz000000011401"/>

PLEASE SUGGEST
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can QTP handle slick grid table in a web page qtplearner88 2 4,277 10-01-2019, 10:44 AM
Last Post: shilpi952
  Reading XML Data from a WebPage shaan.mishra87@gmail.com 1 2,029 09-28-2016, 09:16 PM
Last Post: supputuri
  DP Web Browser/Page issues rstimers 1 2,302 08-14-2015, 12:37 PM
Last Post: venkatesh9032
  XML FILE COULD NOT BE PARSED tripathy.pilu23 1 7,825 04-18-2014, 06:38 AM
Last Post: kgovadav
Rolleyes Urgent help with Gmail Sending mail feature nidhitaneja 2 2,741 03-05-2014, 09:39 PM
Last Post: nidhitaneja

Forum Jump:


Users browsing this thread: 1 Guest(s)