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

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