Hi Christian,

I on the fly transformed some simple XML, which I edit on GitLab, into maps for join operations. I wanted to test performance with the maps being on my machine, and so I was looking for a quick solution to export them into a file/the GUI. I thought I could also run them with xquery:eval, but then I realized that problem about serialization of text nodes. Anyway, the conversion speeds up the lookups considerably, so I think I will adopt the on-the-fly transformation. Thanks for your answer!

Best,
Giuseppe

On Aug 19, 2019, at 4:52 PM, Christian Grün <christian.gruen@gmail.com> wrote:

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