Open cdanger opened 2 months ago
It makes sense to support the latest available version. Support for XPath is optional so including 3.0/3.1 doesn't impose a burden on implementators who ignore XPath.
There is a section in the core spec that discusses the implementation-defined aspects of XPath 2.0. We should also cover XPath 3.0/3.1.
I added a paragraph to my original comment on JSON processing capabilities introduced in XPath 3.1, which allows to mimic JSONPath (#5 ) evaluation with XPath syntax!
Should we also deprecate XPath 1.0?
25 years seems like a good run so that makes sense to me. Given that XPath 3.1 has been around for 7 years is it reasonable to ask the same thing about XPath 2.0 in v4?
Well, XPath 2.0 was last updated in 2016 and still widely used as far as I know, so I would not throw it away just yet. Also last time I checked there are not so many XPath 3.x implementations out there. Sure we have at least one in Java, so no problem there, but other developers in other programming languages might not be so lucky. What's your experience?
My experience is that everything in my world has moved to JSON :)
I did some poking around and it looks like XPath 2 is still very much in use...to the point that it seems pretty clear there isn't a lot of interest in XPath these days.
Indeed, it's time to move that to a separate xacml profile #33 so that the JSON fan base doesn't have to deal with that in the core spec :stuck_out_tongue_winking_eye: . see #33
XACML 3.0 only supports XPath 1.0 and 2.0 (which is over 10 years old). This is a enhancement proposal to support XPath 3.0 and/or latest 3.1.
The new features in XPath 3.0 / 3.1 are well summarized in Saxonica's documentation. Just to give a few:
EDIT: One of the great features of XPath 3.1 is JSON processing and support of JSONPath-like evaluation. See this example based on Altova's documentation using the new
parse-json
function and lookup operator:This XPath expression applied to the string (JSON object)
'{"employees" : {"employee" : {"id": 1, "name": "Chris", "age": 41}}}'
for example will return41
.In this example the 'parse-json' function returns a map which contains nested maps. The 'lookup' operator is used numerous times to access the associated values of keys in the nested maps i.e. ?employees?employee?age