Bug / Issue Tracking Service
Bugzilla – Bug 16118
Maps should be first class citizens
Last modified: 2012-02-25 16:44:05 UTC
I think that this is important for XSLT and XQuery users to be able to traverse
maps like they traverse XML fragments (with the same level of flexibility and
syntaxes that are kept as close as possible). And yes, that means being able to
apply templates over maps and be able to update maps using XQuery update…
But I also think that this will be important to other technologies that rely on
XPath such as (to name those I know best) XForms, pipeline languages (XPL,
XPROC, …) and Schematron.
Being able to use XForms to edit JSON object is an obvious need that XForms 2.0
is trying to address through a “hack” that has been presented at XML Prague
In a longer term we can hope that XForms will abandon this hack to rely on XDM
maps XForms relies a lot on the notions of nodes and axes. XForms binds
controls to instance nodes and the semantics of such bindings would be quite
different to be applied to XDM map entries as currently proposed.
XML pipeline languages are also good candidates to support JSON objects. Both
XPL and XProc have features to loop over document fragments and choose actions
depending on the results of XPath expressions and again the semantics of these
features would be affected if they had to support XDM maps as currently
Schematron could be a nice answer to the issue of validating JSON objects.
Schematron relies on XPath at two different levels: its rules are defined as
XPath expressions and it is often very convenient to be able to use XPath axes
such as ancestor and its processing model is defined in term of traversing a
tree. Again, an update of Schematron to support maps would be more difficult is
maps are not similar to XML nodes.