Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

file write serialization tests #134

Open
benibela opened this issue Jan 23, 2021 · 5 comments
Open

file write serialization tests #134

benibela opened this issue Jan 23, 2021 · 5 comments
Labels

Comments

@benibela
Copy link

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..

@ChristianGruen
Copy link
Member

It’s supposed to be {"a": "foo"}.

@benibela
Copy link
Author

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": "&lt;&gt;foo"} ?

@ChristianGruen
Copy link
Member

I’d need to check the W3 serialization spec in more depth to give a helpful answer (fn:serialize('&quot;&lt;&gt;') returns "&lt;&gt;).

@benibela
Copy link
Author

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

@michaelhkay
Copy link
Member

michaelhkay commented Jan 26, 2021 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants