[XPath30] Proposed new XPath function: dynamically evaluate strings as XPath

Dear Members of the W3C XPath, XQuery, and XSLT Working Groups,



I am a department head overseeing software engineering staff who support multiple U.S. Federal government projects. Many of the projects we support  would benefit enormously from the ability to dynamically evaluate strings as XPath. I would like to request that a new XPath function be added. Here are several use cases followed by a description of the desired XPath function:



In one project there is an application that evaluates a series of XML documents; each document is evaluated based on a security policy. The policies are expressed as XPath, in a separate XML file. The application identifies suspicious nodes in the XML documents, bookmarks them using the XPath 3.0 path() function [1], and then generates a report showing the XPath to the suspicious nodes along with a description of the policy that has been violated.. Then a security expert conducts a Reliable Human Review (RHR) of the report. Periodically the policies are modified. This currently involves stopping the application, reconfiguring the code, reaccrediting the code, and then reinstalling the application. This is extremely expensive and time-consuming. With a function that evaluates arbitrary XPath expressions our policy file could be updated and the application could dynamically evaluate the new policies. Thus, there would be no need to stop the application, reaccredit, and reinstall; this would result in a huge decrease in cost and a huge gain in efficiency.



In another project we have operational rules, such as aircraft fuel consumption calculations and aircraft flight performance characteristics, expressed in XPath. These rules can be made more easily configurable if they are held in a separate file maintained by an operational expert. With a function that evaluates arbitrary XPath expressions, we will be able to have an application that reads in the operational rules and dynamically evaluates them.



Several projects have this situation: a user enters an XPath string that described how he wants data sorted or grouped. That is, the sort key and the grouping key are specified as external XPath expressions. An application then reads in the XPath string and dynamically evaluates them to sort/group the data.



Some projects want to use XPointer-like schemes for cross-referencing within or across documents using XPath expressions.



Our test teams would like to create test frameworks which use XPath expressions to make test assertions.



As you can see, we have important use cases in numerous projects that would benefit from the ability to dynamically evaluate strings as XPath expressions.



We are aware that a detailed specification of such a function will require definition of the static and dynamic context for the XPath evaluation. However, we think that the need for this is reduced by the new EQNames which make it possible to write XPath expressions with no dependency on the namespace context.



We are aware that some of the traditional use cases for dynamic evaluation are (better) handled using higher order functions; however, HOFs do not tackle all requirements.



We want this new functionality to be XPath that is evaluated because this new function will be used in our XQuery code, as well as our XSLT, Schematron, and XML Schema 1.1 code.



We humbly request that Working Groups provide a new function that takes one argument which is an arbitrary XPath expression, represented as a string, and returns the corresponding items. Perhaps it could be called: xpath-eval(), or some such thing.



We imagine the new function behaving like this:



                xpath-eval('arbitrary xpath expression')



evaluate the string (which could be a map, a path expression, a function, etc.) and returns a sequence of items.



Thank you for your consideration.



Carole

Carole Mahoney
Department Head
E54C - Agile and Adaptive Software Engineering
The MITRE Corporation
202 Burlington Road
Bedford, MA 01730
781-271-8737
cmahoney@mitre.org<mailto:cmahoney@mitre.org>




[1] The path() function is described here: http://www.w3.org/TR/xpath-functions-30/#func-path

Received on Tuesday, 3 September 2013 21:19:40 UTC