This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29872 - [FO31] escape=yes in parse-json() and json-to-xml()
Summary: [FO31] escape=yes in parse-json() and json-to-xml()
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2016-09-26 10:06 UTC by Michael Kay
Modified: 2016-12-16 14:59 UTC (History)
0 users

See Also:


Description Michael Kay 2016-09-26 10:06:49 UTC
The rules for fn:parse-json say:

If the escape option is set to true, escape sequences are retained in their escaped form, whether or not they represent valid characters.

(This is in rule 3 underneath the options table. I would have expected to find it in the "escape=true" row of the table, but never mind.)

This rule means that, for example, parse-json("\u0025" map{"escape":true()}) returns "\u0025" rather than "%".

For the fn:json-to-xml() function I cannot find a corresponding rule. There doesn't seem to be anything that dictates whether "\u0025" should end up as <string escaped="true">\u0025</string> or as <string>%</string>.

I suggest we adopt the same rule (and move it into the table, in both cases.)
Comment 1 Michael Kay 2016-09-27 22:18:19 UTC
The changes were agreed and have been applied.
Comment 2 Michael Kay 2016-12-16 14:59:10 UTC
This decision was subsequently reversed: see comment #11 et seq of bug #28812.