W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2015

[Bug 28179] New: [F+O 3.1] handling of numbers in json-to-xml() is underspecified

From: <bugzilla@jessica.w3.org>
Date: Mon, 09 Mar 2015 15:40:00 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-28179-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28179

            Bug ID: 28179
           Summary: [F+O 3.1] handling of numbers in json-to-xml() is
                    underspecified
           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

The spec for json-to-xml() does not make it clear whether the JSON input

23e0

should generate

<number>23</number>

or

<number>23e0</number>

or something else.

Two options that one could use are:

(a) retain the JSON lexical form

(b) convert the JSON lexical form to xs:double using string-to-double
conversion, and then convert the xs:double to string

The advantage of (a) is that there is never any loss of precision (there's
nothing in JSON that limits the number of digits in a number). But the spec
hints that (b) was intended, in that it mentions the rules for string-to-double
conversion.

Note however that in the reverse mapping, xml-to-json(), retaining the lexical
form is not an option, because the lexical space of xs:double is a superset of
the JSON number format (for example, JSON does not allow 015, or .12).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Monday, 9 March 2015 15:40:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:53 UTC