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

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29588

            Bug ID: 29588
           Summary: [fo31] xml-to-json - rules for duplicate keys
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators 3.1
          Assignee: mike@saxonica.com
          Reporter: mike@saxonica.com
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

The spec for xml-to-json states that duplicate keys are disallowed, as a
consequence of the requirement for the input XML to be valid against our
published schema. Our schema says that the @key attribute must be unique for
all the element children of a <j:map> element.

This doesn't quite achieve the desired effect. For example the following are
disallowed as duplicates, when in fact they are different keys:

<j:null key="\n" escaped-key="true"/>
<j:null key="\n" escaped-key="false"/>

and the following pair are not disallowed, although they are different
representations of the same key:

<j:null key="\n" escaped-key="true"/>
<j:null key="&#xa;"/>

It's possible to solve the first problem by tweaking the schema (make the
uniqueness constraint apply to the combination of @key and @escaped-key).
Solving the second problem is harder. It could potentially be done using an XSD
1.1 assertion, using a regex to unescape the key values and compare them in
unescaped form. (But handling escaped surrogate pairs - even well-formed ones -
using regular expressions is not easy!). It would be simpler to state the
constraint in prose as part of the xml-to-json function specification, rather
than relying on the schema.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Saturday, 23 April 2016 20:43:48 UTC