XML.NodeCount broken? Says requires string not number

  • 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.

    Affected Browsers

    None, its an C2 editor issue

    Operating System and Service Pack

    latest Win 8.1 64 Bit

    Construct 2 Version ID

    r197

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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...

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)