question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue serializing sequences that are members of an array

See original GitHub issue

Evaluating any of the following in FontoXPath

[(1,2)]
[[1,2]?*]
array:append([],  (1,2))

Expected

Evaluates to an array with a sequence; [(1,2)]

Actual

Returns an error “Serialization error: The value of an entry in an array is expected to be a singleton sequence.”

Testlink:

https://xpath.playground.fontoxml.com/?mode=1&variables={}&xml=<root%2F>&xpath=(%3A+-+sequence+items+will+become+individual+members+-+%3A) array{(1%2C+2)}%2C array{[(1%2C+2)]%3F*}%2C (%3A+construct+an+array+with+a+sequence+as+a+member+[(1%2C2)]+%3A) [(1%2C2)]%2C [[(1%2C+2)]%3F*]%2C array%3Aappend([]%2C+(1%2C2)) &context=

It may even be represented correctly in the AST but cannot be serialised.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DrRataplancommented, Apr 9, 2021

I improved the error message a bit, It was lying a bit since non-singleton sequences are sometimes valid (in the case of the empty sequence, which is converted to null).

While I like your suggestion for a more raw output format, I am afraid it will get too explicit too fast. I will keep it in the back of my mind though because it might be very valuable in the playground. I hope no one will want to process it in their own production application that depends on FontoXPath.

I’ll close this issue when the error messages PR is integrated. Thanks for bringing this to our attention!

Regards,

Martin

0reactions
line-ocommented, Apr 9, 2021

Thanks for taking it into consideration. I understand that it might be out of scope and there is a valid way to get there by explicitly wrapping a sequence in array {}.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AXIS array serialization: Incorrect element names of items in a ...
AXIS array serialization: Incorrect element names of items in a list. Status: Assignee: Priority: Resolution: Open. Unassigned. Critical.
Read more >
How to serialize duplicate XML elements into an array?
I'm attempting to serialize some poorly formatted XML. I'm specifically having issues converting duplicate elements into an array. In usual ...
Read more >
serializing a json array using {} instead of [] · Issue #373 - GitHub
I noticed that when array have empty element (like yours [ ]) it is serialized with the indexes. Maybe you have some empty...
Read more >
Controlling XML Serialization Using Attributes - Microsoft Learn
Attributes can be used to control the XML serialization of an object or to create an alternate XML stream from the same set...
Read more >
Serialization of Classes - Boost C++ Libraries
a class member function serialize; a global function serialize ... it is a reference to a Serializable type. it is a native C++...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found