Server protocol bug?

Sunday, 17 May 2015 · 3 messages · last reply 18 May 2015
A
alxarch17 May 2015 17:54 #

Hi,

While testing for basex-stream i encountered a weird behavior in the OPTIONS query command.

After creating the query

declare option output:method "json";
declare option output:json "lax";
<json type="object"/>

the response of OPTIONS was:

json=lax=true,method=json

Which seems wrong.

I event tried setting cdata-section-elements to "pre, code" and the response had a double comma ("cdata-section-elements=pre,,code,method=xml")

Is this a bug or is there some deterministic method of parsing the response?

Thanks, Alex

CG
Christian Grün18 May 2015 10:05 #

The behavior is correct indeed. But I agree it is surprising, and it has not properly been documented so far:

Quoted text · alxarch · 1 line
> declare option output:json "lax";

This is a shortcut for "lax=true". Thus, the boolean value will always be appended in the string representation, no matter if it has been specified in the original serialization option.

Quoted text · alxarch · 3 lines
> I event tried setting cdata-section-elements to "pre, code" > and the response had a double comma > ("cdata-section-elements=pre,,code,method=xml")

Single commas will be duplicated, such that they can be distinguished from option separators. This was only documented for the BINDINGS option, but not it's also documented for serialization parameters [1] and the server protocol.

Thanks, Christian

[1] http://docs.basex.org/wiki/Options#SERIALIZER

A
alxarch18 May 2015 17:47 #

I missed the obvious part of option 'suboptions' I fixed the parsing in basex-stream and now query.options() returns an object in v0.1.2.


⚡Generated with XQuery