Skip to content

Allow for escaped quotes in webforms xpath #492

@garethbowen

Description

@garethbowen

If for any reason a form needs to escape quotes in a string the current xpath processing will fail.

Firstly the tree-sitter-xpath grammar will fail to parse the xpath. This is because string literals are defined as _literal: () => choice(/"[^"]*"/, /'[^']*'/) which doesn't check for any form of escaping so it isn't as greedy as it should be.

Secondly the xpath evaluator will need to be modified to unescape the strings at the right time.

There are multiple methods of escaping quotes in xpath so part of this issue will be to decide which to support. Some examples are: \', ''', '.

This was first discovered while implementing the pulldata function ( #242 ) which fails in web-forms and Enketo if the resolved query string contains a single quote.

There's a forum post outlining the issue in Enketo.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions