slaugier
6 years agoOccasional Contributor
How to get a string value from context.expand path with variables
Hi
I discover Groovy and the context.expand() way to find elements.
I want to get the value a:AccountTypeTextId=="LongTermLiquidity" as shown in this copyscreen below
If I execute this command , it works :
LongTermLiquidity = new String (context.expand( '${GetHoldings#Response#declare namespace ns1=\'http://xxx.com/Schemas/yyy/Operations\'; declare namespace a=\'http://xxx.com/Schemas/yyy/Data/Advice\'; //ns1:GetHoldingsResponse[1]/ns1:GetHoldingsResult[1]/a:AccountDto[1]/a:AccountTypeTextId[1] }' ))
But if I execute this line, it doesn't work :
LongTermLiquidity = new String (context.expand( '${GetHoldings#Response#declare namespace ns1=\'http://xxx.com/Schemas/yyy/Operations\'; declare namespace a=\'http://xxx.com/Schemas/yyy/Data/Advice\'; //ns1:GetHoldingsResponse[1]/ns1:GetHoldingsResult[@.a:AccountTypeTextId=="LongTermLiquidity"]/a:AccountDto[1]/a:AccountTypeTextId[1] }' ))
Can someone explain me how to deal with ns1:GetHoldingsResult[@.a:AccountTypeTextId=="LongTermLiquidity"] in order to get a valid result?
Thank you
Sylvain