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.
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
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