Open benibela opened 3 years ago
It’s supposed to be {"a": "foo"}
.
Because "
does not need to be escaped at all? How about this test case: file:write("output.json", "{""a"": ""<>foo""}" )
. Is it {"a": "<>foo"}
or {"a": "<>foo"}
?
I’d need to check the W3 serialization spec in more depth to give a helpful answer (fn:serialize('"<>')
returns "<>
).
There is not really a point in escaping >
and not escaping "
or vice verse.
For characters such as > where XML defines a built-in entity but does not require its use in all circumstances, it is implementation-dependent whether the character is escaped.
https://www.w3.org/TR/xslt-xquery-serialization-31/#serphases
On 26 Jan 2021, at 11:38, Benito van der Zander notifications@github.com wrote:
There is not really a point in escaping > and not escaping " or vice verse.
If you're processing a text node, then escaping " is pointless, but escaping ">" unconditionally saves you the hassle of checking to see whether it's part of a "]]>" sequence.
Michael Kay Saxonica
There are no tests for file:write in https://github.com/expath/expath-cg/blob/master/tests/qt3/file/file.xml
All the serialization tests from qt3 could be imported for it
One case, I am not sure about, is the expected output of
file:write("output.json", "{""a"": ""foo""}" )
. Is it{"a": "foo"}
or{"a": "foo"}
. Probably former, but that is useless..