Bug #2692
closed
Incorrect output from xml-to-json function, for an empty array inside an array
Category:
XSLT conformance
Fix Committed on Branch:
9.7
Fixed in Maintenance Release:
Description
Raised by a user on the support mailing list.
Applying the xml-to-json() function to the following input:
<number>3</number>
<array/>
<number>4</number>
Returns the JSON output:
[3,[]4]
i.e. there is a comma separator missing after the empty array.
Also applies where an empty map is output within an array.
- Status changed from New to In Progress
- Assignee set to Debbie Lockett
Tests xml-to-json-A014, xml-to-json-A015, xml-to-json-B014, xml-to-json-B015 added to the XSLT 3.0 test suite. Testing both empty arrays and empty maps inside an array.
- Status changed from In Progress to Resolved
- Fix Committed on Branch 9.7 added
The problem was that JsonReceiver was not setting atStart to false after processing an empty map or array.
Fix made to JsonReceiver.endElement() to set atStart=false unconditionally.
Patch committed on 9.7 and dev branches.
Another user has pointed out that the same bug affects maps containing an empty map or array as the value of a pair (which is not the last).
e.g. xml-to-json(json-to-xml({A":{},"B":1})) returns {"A":{}"B --- with a missing comma.
The patch already committed for this bug fixes this issue. Further new tests (xml-to-json-A017, A018, B017, B018) have been added to the XSLT 3.0 test suite.
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.7.0.5 added
Bug fix applied in the Saxon 9.7.0.5 maintenance release.
- Sprint/Milestone set to 9.7.0.5
Please register to edit this issue
Also available in: Atom
PDF