-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[core] Abstract XPath rulechain conversion using our own XPath parser #1243
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
a:RFCA drafted proposal on changes to PMD, up for feedback form the team and communityA drafted proposal on changes to PMD, up for feedback form the team and communityfor:performanceThe goal of this change is to improve PMD's performanceThe goal of this change is to improve PMD's performancein:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionwas:wontfix
Metadata
Metadata
Assignees
Labels
a:RFCA drafted proposal on changes to PMD, up for feedback form the team and communityA drafted proposal on changes to PMD, up for feedback form the team and communityfor:performanceThe goal of this change is to improve PMD's performanceThe goal of this change is to improve PMD's performancein:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionwas:wontfix
Type
Fields
Give feedbackNo fields configured for issues without a type.
Fact: Saxon’s API is very impractical, not made for expression transformation or even inspection at all. Given how deep we’d have to delve to get anything working, it’s likely that version updates would break everything anyway.
We could maintain our own XPath parser. This would abstract us from Saxon/Jaxen and individual versions thereof, and allow us to identify more optimisation opportunities. Given an AST, we can perform optimising transformations, and identify rulechain visits, then dump it to an XPath expression string and let Saxon parse it to its own representation. This parser could also be used in the designer, as suggested in #1192
Interesting things that could be done with that:
//N[$reportNs=true()] | //M[$reportMs=true()]. The value of the property never changes at run time, which Saxon can’t know (we use a dynamic context). But if e.g.$reportMsis set to false, then the M branch can be safely discarded, and only one rulechain visit would be added.//A/(B | C)/X->//A/B/X | //A/C/X, which is currently ignored by Jaxen IIRC)Things to care about: