Hi Giuseppe,
The exact rules for serializing maps can be looked up in the specification for XQuery Serialization 3.1 [1].
I can’t say too much about all the decisions that have been taken in the spec, but I remember that all decisions around the adaptive serialization method were, more or less inevitably, a compromise between finding a both easily accessible representation and one that keeps faith to specific data types. In real applications, it’s probably good not to serialize maps and arrays at all, and work with the contained data instead. If the output needs to be further processed, the JSON functions may be the ones to choose.
In which context do you work with serialized maps?
Cheers, Christian
[1] https://www.w3.org/TR/xslt-xquery-serialization-31/
On Mon, Aug 19, 2019 at 1:56 AM Giuseppe G. A. Celano celano@informatik.uni-leipzig.de wrote:
Hi
When maps are serialized, the text nodes of an element (e.g., <g>r</g>/text()) are serialized without quotes and tests with "instance-of" show that they actually are text nodes: Couldn't they be serialized with quotes? I see that with data(), the text is serialized with quotes although it is xs:untypedAtomic. Is there a reason why the text node is kept as such and, for example, no casting/atomization happens when it becomes a value in a map? Thanks.
Best, Giuseppe