I think one can probably prove that no mapping JSON to/from XML will satisfy all the following objectives: (1) Handles any JSON document (2) Handles any XML document (3) is round-trippable (to-json(to-xml(J)) = J, and to-xml(to-json(X)) = X). and the more you try and get close to this, the more you sacrifice two further objectives (4) produces a user-friendly XML representation of JSON (5) produces a user-friendly JSON representation of XML In the XSLT 3.0 mapping we focused on achieving (1) and (3) and doing the best we could on (4) within these constraints. One reason we chose these objectives is that the user is operating in a world where they have good tools for transforming any XML that comes out of the conversion to a form that they prefer. If you choose a different set of objectives you will end up with a different mapping. Michael Kay Saxonica
|