Open amclark42 opened 3 years ago
@amclark42 Thank you for reporting this and developing tests!
I can reproduce the bug by running the supplied xqsuite test on my local 5.3.0 instance. The test suite returns:
<testsuite package="http://exist-db.org/xquery/test" timestamp="2021-07-29T14:26:28.618-04:00"
tests="3" failures="0" errors="1" pending="0" time="PT0.003S">
<testcase name="exist-doc" class="t:exist-doc">
<error type="err:FOJS0006" message="Invalid XML representation of JSON."/>
</testcase>
<testcase name="exist-in-memory" class="t:exist-in-memory"/>
<testcase name="shim-doc" class="t:shim-doc"/>
</testsuite>
The tests in https://github.com/eXist-db/exist/blob/develop/exist-core/src/test/xquery/xquery3/xml-to-json.xql do not test the application of the fn:xml-to-json
function to nodes stored in the database.
Nice and clean test!
Describe the bug
fn:xml-to-json#1
will sometimes fail to translate a valid XML representation of JSON, when that XML has been stored in the database. The error returned is FOJS0006, “Invalid XML representation of JSON.”Expected behavior I expected that the function would take the pseudo-JSON document or outermost node and convert the XML into a JSON string. The same XML can be successfully converted when it’s hard-coded in an XQuery variable.
To Reproduce
Context (please always complete the following information):