Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle keys with numbers #120

Open
mapi33 opened this issue Nov 30, 2019 · 1 comment
Open

Handle keys with numbers #120

mapi33 opened this issue Nov 30, 2019 · 1 comment

Comments

@mapi33
Copy link

mapi33 commented Nov 30, 2019

Taking the following json, defiant.search(json, "//percents/15") returns
Evaluation failed: DOMException: Failed to execute 'evaluate' on 'Document': The string '//percents//15' is not a valid XPath expression.

defiant.search(json, "//percents/*[@name='15']) returns {}

 {
        "volume": "1109718.9267420967",
        "percents": {
          "1": {
            "buy_pressure": 154084.47,
            "sell_pressure": 20663.32,
            "books_24_hours_avg": 441286.47219814226
          },
          "2": {
            "buy_pressure": 299911.21,
            "sell_pressure": 299872.79,
            "books_24_hours_avg": 836768.6396904029
          },
          "5": {
            "buy_pressure": 403699.71,
            "sell_pressure": 780519.51,
            "books_24_hours_avg": 955530.720696594
          },
          "10": {
            "buy_pressure": 403699.71,
            "sell_pressure": 780519.51,
            "books_24_hours_avg": 955747.7552476776
          },
          "15": {
            "buy_pressure": 403699.71,
            "sell_pressure": 780519.51,
            "books_24_hours_avg": 955747.7552476776
          }
        },
        "buy_pressure": "403699.71",
        "markets_count": 1,
        "sell_pressure": "780519.51",
        "books_24_hours_avg": 955747.7552476776
},
@nicohell
Copy link

nicohell commented May 11, 2020

Same issue :

defiant.search(search, '//2020-05-05[setStart]');

Failed to execute 'evaluate' on 'Document': The string '//2020-05-05[setStart]' is not a valid XPath expression.

{"search": { "2020-05-05": { "period": "weekly", "setStart": "2020-05-01" }, "2020-05-06": { "period": "daily", "setStart": "2020-05-01" } } }

Also tried without Hyphens :

Failed to execute 'evaluate' on 'Document': The string '//2020[setStart]' is not a valid XPath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants