Skip to content

Cannot use 'in' operator for 'string' #15

Description

@strattonn

<Controllers FormID="d4010c78-1af2-4d44-bcc3-5cb79f3b2dae"> <Controller ID="cbd2b66a-0121-474c-b038-54b9af8bb00e"> <ViewName>Task List</ViewName> <Fields> <Field ID="68fd01c4-a545-91bb-1821-1d90dbec2e69" > </Field> </Fields> </Controller> </Controllers>

Given the preceeding XML, the following will return one node.
xpath.evalFirst(controllerXML, "/Controllers/Controller[@ID='cbd2b66a-0121-474c-b038-54b9af8bb00e']/Fields/Field[@ID='68fd01c4-a545-91bb-1821-1d90dbec2e69']/Name");

The following fails with the message, "Cannot use 'in' operator for 'string'"
xpath.evalFirst(controllerXML, "/Controllers/Controller/Fields/Field[@ID='${fieldId}']/Name");

Line 120 in xpath is the offending line. When it fails json is set to "".
if (node in json) {

Changing line 120 to this fixes the error for me, not sure if that's the best fix.
if (json && node in json) {

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions