Get a whole XML object from xpath instead of a single value

Hi everyone, i need a bit of help with some XML parsing. I’ve only ever used jsonPath before, so xpath is completely new for me.

Firstly, please imagine we have an API that returns a list of election dates like this:

FV2019 FV 2019-06-05T00:00:00 Folketingsvalg 2019 RV2020 RV 2020-12-01T00:00:00 Regionsvalg 2020

I want to pick one of the elements and look it up on a different endpoint.

Here is some Gatling code that works.

val scn = scenario(“Valg”)
.exec(http(“Returnerer alle valg fra databasen”)
.exec(http(“Returnerer et enkelt valg - ${ValgId}”)

Thing is though, when I get to the second API call i want to know that the name matches the one found in the first list. So instead of saving the the i should really save the whole object to session and later look at both the and within it.

I’m pretty sure with jsonPath i’d do something like .ofType[Map[String,Any]] but xpath doesn’t seem to like that.

All of the xpath examples i can find get a single attribute, not an object.

So … is it possible? Does my question even make sense?

Lots of love, and good weekend!