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

[Bug 28947] [SER 3.1] Adaptive method: sequences of length >1 in maps and arrays

From: <bugzilla@jessica.w3.org>
Date: Tue, 14 Jul 2015 09:08:11 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-28947-523-t5Sm2z5PSC@http.www.w3.org/Bugs/Public/>

--- Comment #1 from Michael Kay <mike@saxonica.com> ---
More generally, it's hard to see the logic (and in some cases to decipher the
rules) as to when quotes are used by the adaptive output method, especially
within the values of maps and arrays.

For example, because it inherits the rules from the JSON method, an element is
output in quotes:

[ "<a/>" ]

using JSON escaping for nested quotes:

[ "<a class=\"para\"/>" ]

But it's not clear whether quotes are used for functions:

A function item is serialized to the representation "function name#A"

but the test cases suggest that the quotes here are not intended to be part of
the target representation.

Thinking about this overall, I think we've ended up with a very muddled mix of
XPath and JSON syntax. I think it would be much better if we targeted something
close to XPath syntax, perhaps as follows:

The outermost sequence is serialized by serializing each item, as described
below, separated by the chosen item separator.

Atomic values: values of type xs:string, xs:decimal, and xs:double are output
as XPath literals, for example "London", 1.23, 1.5e0. Values of type xs:boolean
are output as "true()" or "false()". Values of type xs:untypedAtomic are output
as string literals, for example "London". Values of other primitive types are
output using the syntax of a constructor function with a string literal
argument, for example xs:date("2015-07-14").

Nodes: as now.

Maps: output as map{key=value, ...} where key is an atomic value as above, and
value is described below.

Arrays: output as [value, value, ...] where value is as described below.

Functions: as now.

Values within maps and arrays: In general, these are output as a sequence of
items, surrounded by parentheses and separated by ",". The parentheses are
optional in the case of a sequence of length 1. (This allows streaming
serializers to output the opening "(" without knowing the length of the
sequence). The chosen item-separator is NOT used.


Query: //para

<para>One para</para>
<para>Para two.</para>

Query: count(//para)


Query: current-date()


Query: avg((//para)!string-length())



Query: (//para)!(position()||": "||title)


"1: Introduction"
"2: Early Life"
"3: Nemesis"

Query: //para/@*



Query: array { 1 to 5 }



Query: array { //para }


[<para>One para</para>,<para>Para two</para>]
[(<para>One para</para>),(<para>Para two</para>)]

Query: map:merge( //para ! map:entry(position(), .) )


map{1:<para>One para</para>,2:<para>Para two</para>}
map{1:(<para>One para</para>),2:(<para>Para two</para>)}

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Tuesday, 14 July 2015 09:08:14 UTC

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