DataSource-XML not returning data
I have an XML response that loos like this
<soap:Envelope> <soap:Body> <getDocumentNamesResponse> <documentName>AAABRIDGE</documentName> <documentName>WSCLIENT</documentName> <documentName>XML_AGENT</documentName> <documentName>ZZZTESTING2</documentName> </getDocumentNamesResponse> </soap:Body> </soap:Envelope>
I want to iterate over this response with a DataSource/DataSourceLoop
So I configured DataSource-XML step as
Property = 'documentName'
Source Step = XML
Source Property = Response
Row Xpath = //ns1:getDocumentNamesResponse[1]/ns1:documentName[1]
Column Xpaths = documentName/text()
But this returns nothing
I also tried
Changing the Column Xpath to just "ns1:documentName[1]" and now it returns the first documentName but nothing else. I tried changing it to ns1:documentName[] and ns1:documentName but then nothing is returned.
Row Xpath = //ns1:getDocumentNamesResponse[1]/ns1:documentName
Column Xpath = ns1:documentName
this returned 100 empty rows (100 is the total count, I manually shortened the xml to make it easier to read on here)
Row Xpath = //ns1:getDocumentNamesResponse[1]
Column Xpath = ns1:documentName
This returned just the first documentName element
If anyone can offer any advice i'd appreciate it.
Well I managed to get it to work with that note.
Row XPATH should be (including whatever namespaces you have, so ns1?)
//ns1:getDocumentNamesResponse[1]/ns1:documentName
Column XPATH:
text()
Can you try that?(Edit for missing / on row xpath)
You really got my hopes up.
Made the Row Xpath
declare namespace ns1='mynamespace';
/ns1:getDocumentNamesResponse[1]/ns1:documentName
Column XPath
text()
But I get 0 results
So then I tried
declare namespace ns1='mynamespace';
//ns1:getDocumentNamesResponse[1]/ns1:documentName
So the difference is the slashes, "//" versus "/" and guess what? IT WORKS!!!!!!
AAABRIDGE ADDMONTHLY ADDRESS_VALIDATION ATLAS_SALESFORCE_AUTHSERVICE AUTHENTICATION_SERVICE AUTHORIZATION BATCH_PROCESSING_SERVICE BILLING BULK_RMA BULK_RMA_GUI I really can't thank you enough for all the time you spent helping me. This will greatly enhance my tests and something I've been wanting to do for a long time but it just never worked for me so I would work around it.