Check Out the Latest News About SmartBear Connect
JOIN OUR WEEKLY CHALLENGE
API_Bloom_banner

API Bloom is a weekly prize-winning challenge in the Ready! API Community. Each week, we assign a task that you need to accomplish to become a winner. See the rules here.

THIS WEEK TASK
Get the biggest number of Kudos for your replies on the Ready! API forums
Top 3 Kudoed members will get $50, $35, and $15 gift cards!

LAST WEEK WINNERS
@nmrao, @msiadak, @Debz, @richie, @Emil91, @PramodYadav, @jkrier

Reply
Highlighted
Occasional Contributor
Posts: 7
Registered: ‎11-14-2016
Accepted Solution

How to Remove extra [] from the Xpath Expression Response.

Hi,

I am using XPath Assertion to compare expected value vs actual

 

Actual

XPath Assertion

//Response[1]/e/columns --- This provides concat values for all the nodes = column under Response/e . But, it gives extra []. Output = [[4.321808818872719,-22.80283626539684,6.0452621008568075,-15.671138277860097]]

 

Is there's a way to remove extra []?

 

My expected value is something like this. This uses "ResponseAsXML" 

 

[4.321808818872719,-22.80283626539684,6.0452621008568075,-15.671138277860097]

 

Frequent Contributor
Posts: 109
Registered: ‎08-04-2016

Re: How to Remove extra [] from the Xpath Expression Response.

It would help if you also post an XML document you are checking.

 

Karel

 

Community Hero
Posts: 4,364
Registered: ‎05-17-2013

Re: How to Remove extra [] from the Xpath Expression Response.

That could be because, result is list.
Occasional Contributor
Posts: 7
Registered: ‎11-14-2016

Re: How to Remove extra [] from the Xpath Expression Response.

This issue is fixed.

 

//Response[1]/e/columns -------- this was giving me an issue with extra []

 

So , i changed it to

 

string-join(//Response[1]/e/columns/text(),',') --- This helped me to remove an extra []

Let's Meet in Boston