Forum Discussion
richie
Community Hero
Hey Nasturshia,
In regards to defining variables as strings or numerics, i just slap a .toString() or .toInteger() on it.
I should highlight variables/properties are saved as text/string type by default.
In regards to what the line is actually doing
[“count((//*[local-name() = ‘list01’] /*[local-name () = list02 and . = + expectedlist + “])”]
I cant actually read this to tell you whats going on.....i would need to know what the content of your response looks like cos i dont know what that local-name() method is doing. This is doing a count followed by the xpath to what is being counted which is then beimg concatenated with whatever variable/property defined as 'expectedlist'.
Im not in front of my laptop to actually try an xpath count (to work out if the count value is being stored as text (e.g. '4') or numeric (e.g. 4), but i'm wondering if 'expectedlist' is a stringtype and thats the problem?
Have you tried removing the concatenation of 'expectedlist' from the variable declaration to see what happens? If you remove it and you dont get the error, that'll mean that the expectedlist property is likely causing the issue.
Thats all i got, im afraid!
Ta
Rich
In regards to defining variables as strings or numerics, i just slap a .toString() or .toInteger() on it.
I should highlight variables/properties are saved as text/string type by default.
In regards to what the line is actually doing
[“count((//*[local-name() = ‘list01’] /*[local-name () = list02 and . = + expectedlist + “])”]
I cant actually read this to tell you whats going on.....i would need to know what the content of your response looks like cos i dont know what that local-name() method is doing. This is doing a count followed by the xpath to what is being counted which is then beimg concatenated with whatever variable/property defined as 'expectedlist'.
Im not in front of my laptop to actually try an xpath count (to work out if the count value is being stored as text (e.g. '4') or numeric (e.g. 4), but i'm wondering if 'expectedlist' is a stringtype and thats the problem?
Have you tried removing the concatenation of 'expectedlist' from the variable declaration to see what happens? If you remove it and you dont get the error, that'll mean that the expectedlist property is likely causing the issue.
Thats all i got, im afraid!
Ta
Rich
Nasturshia
4 years agoOccasional Contributor
Rich as you suggested I did remove the offending variable from the expression and the error is not seen as you predicted.
Now I need to find where the variable is defined.
Now I need to find where the variable is defined.
- HimanshuTayal4 years agoCommunity Hero
Could you give a try to below code:
double count01 = Double.parseDouble([“count((//*[local-name() = ‘list01’] /*[local-name () = list02 and . = + expectedlist + “])”])
-----------------------------------OR-----------------------------------------------------------------
def count01 = [“count((//*[local-name() = ‘list01’] /*[local-name () = list02 and . = + expectedlist + “])”] as Double
Hope it will help you 🙂
Related Content
- 11 years agoashok_natar
- 5 years agosenthkum
Recent Discussions
- 14 days agosmilnik