Open dizzzz opened 3 years ago
@dizzzz I left some notes about this in https://github.com/eXist-db/exist/pull/1929. Most notably:
fn:collection
is documented as non-spec compliant. Because a fix could break code that depends on the current signature, Adam’s PR for this is tagged as bound for eXist 6.0.0. See https://github.com/eXist-db/exist/pull/3313.xs:dateTimeStamp
(see https://github.com/eXist-db/exist/issues/1715)But the fixes to contains-token
, json-to-xml
, and xml-to-json
should definitely be made and I don't see any problem in making these 5.x fixes.
(By the way, I think your results might be flipped: what you say is the spec appears to be eXist's current behavior, and vice versa. For example, the specs say that fn:collection#1
's parameter is xs:string?
, not xs:string*
- the latter is eXist's current behavior.)
@dizzzz Your observations about the signatures of contains-token
, json-to-xml
, and xml-to-json
are still valid. Shouldn't we keep this issue open until those issues are fixed?
This code
xquery version "3.1";
fn:json-to-xml(fn:serialize(fn:json-doc(file:///Users/lcahland/Desktop/foo.json, map {
"liberal": fn:true(),
"escape": fn:true()
}), map {
"method": "json"
}), map {
"liberal": fn:true(),
"escape": fn:true()
})
with the JSON document:
{
"operandRight": {
"type": "literal",
"dataType": "code",
"value": "\u0000"
}
}
returns the following from Saxon
<?xml version="1.0" encoding="UTF-8"?>
<map xmlns=http://www.w3.org/2005/xpath-functions>
<map key="operandRight">
<string key="dataType">code</string>
<string key="value" escaped="true">\\u0000</string>
<string key="type">literal</string>
</map>
</map>
And this from eXist-db 6.0.1. The value in <fn:string key="value"></fn:string>
is a unicode 0x0 and will not store in the database
<fn:map xmlns:fn=http://www.w3.org/2005/xpath-functions>
<fn:map key="operandRight">
<fn:string key="type">literal</fn:string>
<fn:string key="dataType">code</fn:string>
<fn:string key="value"></fn:string>
</fn:map>
</fn:map>
@lcahlander The issue valid but does not have to do with cardinalities. I would suggest to open a separate issue for your finding and rename this issue to mention built-in function cardinality explicitly. My fear is that we will forget to fix your issue when it is in here and other may also not find it.
I compared the cardinality of all (w3c defined) functions in eXist-db with the spec; I found a few differences:
Can these be fixed in 5.x or are these typically 6.x items?