access a url and i get group response as below. I want to store these count for each specific id and compare the results with other response where i get individual response as mention in below.
HOW CAN I ACHIEVE THIS?
Group Response:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <response> <results> <result> <id>Xref</id> <count>1</count> <landingpage>http://xxx.yy.org/1367</landingpage> </result>
<result> <id>Yref</id> <count>2</count> <landingpage>http://xxx.yy.org/1367</landingpage> </result>
</results>
</response>
Individual response:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <response>
<result> <id>Xref</id> <count>1</count> <landingpage>http://xxx.yy.org/1367</landingpage> </result>
</response>
Regards,
Unni
If you are loading the xml up in a browser you should be able to run xpath queries against it.
driver.findElements(By.xpath(“//id”)).size();
The above is of course assuming you use Java (for other languages replace size with whatever command gives you the size of a list/array)
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/yoj-jBvl3KYJ.
For more options, visit https://groups.google.com/groups/opt_out.
OK you aren’t getting XML back you are getting HTML with text that looks like XML.
You could probably grab all the text inside the <pre> tag, convert all < to < and then convert all > to > and then try and programmatically create an XML document from it and then perform some XPath checks on that.
It’s a bit long winded though.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/ceWUWHWsJUcJ.
Go back and read my previous comment again.
You are not getting XML content. You are getting text that looks like XML content all of the < and > have been transformed into html.
You need to get the text of the <pre> element and then transform all the < and > back into < and > and then you can programmatically create a new XML document from it using something like the Java XOM library (http://www.xom.nu/). You can them programmatically perform an XPath query on this XML document to find out how many <id> elements there are, use the XPath //id.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/v5U-MGCDHLAJ.