W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2016

[Bug 29588] [fo31] xml-to-json - rules for duplicate keys

From: <bugzilla@jessica.w3.org>
Date: Thu, 09 Jun 2016 10:29:13 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29588-523-elHdwssc3w@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29588

--- Comment #2 from Michael Kay <mike@saxonica.com> ---
The following changes are made to implement this decision:

(A) The schema for JSON is changed: the uniqueness constraint for maps changes
from

        <xs:unique name="unique-key">
            <xs:selector xpath="*"/>
            <xs:field xpath="@key"/>
        </xs:unique>

to

        <xs:unique name="unique-key">
            <xs:selector xpath="*"/>
            <xs:field xpath="@key"/>
            <xs:field xpath="@escaped-key"/>
        </xs:unique>

(Note: the semantics of xs:unique ensure that (a) if there is no @escaped-key
value, then the default (false) is used; (b) evaluation of the constraint
effectively uses the typed value rather than the string value of the attribute,
so "true", "1", and " 1 " are equivalent.)

(B) In the rules for fn:xml-to-json, after the first numbered list, add:

Furthermore, the input must satisfy the following constraint (which cannot be
conveniently expressed in the schema). Every element M in the input tree having
local name "map" must satisfy the following rule: there must not be two
distinct children of M (say C1 and C2) such that the normalized key of C1 is
equal to the normalized key of C2. The normalized key of an element C is as
follows:

1. If C has the attribute value escaped-key='true', then the value of the key
attribute, with all JSON escape sequences expanded to the corresponding Unicode
characters according to the JSON escaping rules.

2. Otherwise (the escaped-key attribute is absent or set to false), the value
of the key attribute.

(C) In the second error condition (FOJS0006) add the condition "or if a map
element has two children whose normalized key values are the same".

(D) Expand Note 4. "Duplicate key values are not permitted. Most cases of
duplicate keys are prevented by the rules in the schema; additional cases
(where the keys are equal only after expanding JSON escape sequences) are
prevented by the prose rules of this function."

(E) If time permits, add some examples.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Thursday, 9 June 2016 10:29:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:58:00 UTC