XML.NodeCount broken? Says requires string not number

Bugs will be moved here once resolved.

Post » Sat Feb 21, 2015 5:52 pm

Problem Description
When I try to use different XPath expressions for XML.NodeCount it says it requires a string, not a number. But I entered a string!

Attach a Capx
It seems to be an C2 Editor bug and I can't add the action because it says it's a number.

Steps to Reproduce Bug
  • Add XML.NodeCount(XPath) to an action like Set Text and enter a string for XPath.

Observed Result
Error message says it requires a string not a number even if a string is entered.
Image

Affected Browsers
None, its an C2 editor issue

Operating System and Service Pack
latest Win 8.1 64 Bit

Construct 2 Version ID
r197
B
51
S
15
G
6
Posts: 682
Reputation: 8,911

Post » Mon Feb 23, 2015 1:15 pm

NodeCount returns a number, but you are trying to pass that to a Text parameter. That's what the message means. I can't see what action you're using though because you've covered it up and not provided a .capx, but I assume this is working correctly.
Scirra Founder
B
378
S
220
G
84
Posts: 23,871
Reputation: 188,157

Post » Thu Feb 26, 2015 2:36 pm

@Bl4ckSh33p
I know Ashley has already answered this post, but I have been looking at this function this afternoon and what you need to enter is, for example:

str(XML.NodeCount("//examplenode"))

just in case this makes it clearer...
B
3
Posts: 6
Reputation: 187

Post » Thu Feb 26, 2015 5:43 pm

Thank you very much. In another case the error said it needs to be converted with str() or int(). Since it was a different message I forgot to use the str() command. :)
B
51
S
15
G
6
Posts: 682
Reputation: 8,911


Return to Closed bugs

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest