-
Notifications
You must be signed in to change notification settings - Fork 27
XPath returns a node instead of an attribute #340
Comments
The problem is probably the |
More info: the xpath library seems to be Ok and it even have a test for this case so unless we're hitting a corner case with it with our specific usage parameters (I'll do more tests to discard it) the problem seems to be the one stated above. Also, this website (https://www.freeformatter.com/xpath-tester.html) that the Go-xpath lib seems to use as independent testing of the validity of its library (so I guess it uses another lib internally) also fails when the properties start with a "@". We could do this workaround:
Not very pretty, but it should work and would avoid changing all the drivers, fixtures and testing code to replace the |
The token specifically is mapped to the node's content. Since does might have both token and children, I also projected is as a separate child node (
And we don't have any other |
Yeah, |
Is this an issue that arises from queries generated inside the library (rather than directly by users), and if so can we work around it by adding quotes explicitly? I'm pretty sure XPath allows "@" in values, as long as they're escaped. |
Nope, no scaping of symbols in property names for XPath 1.0 as far as I investigated. Double quotes doesn't work either. This would also affect users, actually I found about this while upgrading the Python client's unittests. The solution proposed by @dennwc of creating internally a 'token' property with the @token should be simple to implement. |
P.S. I believe it was already implemented and merged ;) We just haven't updated the docs. |
From the new Python client:
See bblfsh/python-client#128 (comment)
Related either to XPath projection in SDK, or XPath library itself.
The text was updated successfully, but these errors were encountered: