serialize vs csv:serialize
Friday, 20 July 2018 · 2 messages
GC
Giuseppe Celano20 Jul 2018 15:45 #
Hi All,
I am not sure whether the serialize function is working properly (the first example works, the second does not, because instead of tabs I get commas, and there is no way to specify to add the header)
<csv>
<record>
<a>f</a>
<b>f</b>
<c>f</c>
<d>f</d>
<e>f</e>
<f>f</f>
</record>
</csv> => csv:serialize(map{"header":"yes", "separator": " "})return
a b c d e f
f f f f f f
<csv>
<record>
<a>f</a>
<b>f</b>
<c>f</c>
<d>f</d>
<e>f</e>
<f>f</f>
</record>
</csv> => serialize(map{"method":"csv", "item-separator": " "})f,f,f,f,f,f
Thanks!
Giuseppe
CG
Christian Grün20 Jul 2018 15:50 #
Hi Giuseppe,
If you use
fn:serialize, you can use the 'csv' parameter to assign CSV serialization options [1].
Hope this helps,
Christian
[1] http://docs.basex.org/wiki/Serialization
Giuseppe Celano <celano at informatik.uni-leipzig.de> schrieb am Fr., 20. Juli 2018, 15:45:Quoted text · Giuseppe Celano · 40 lines
> Hi All, > > I am not sure whether the serialize function is working properly (the > first example works, the second does not, because instead of tabs I get > commas, and there is no way to specify to add the header) > > <csv> > <record> > <a>f</a> > <b>f</b> > <c>f</c> > <d>f</d> > <e>f</e> > <f>f</f> > </record> > </csv> => csv:serialize(map{"header":"yes", "separator": " "}) > > return > a b c d e f > f f f f f f > > <csv> > <record> > <a>f</a> > <b>f</b> > <c>f</c> > <d>f</d> > <e>f</e> > <f>f</f> > </record> > </csv> => serialize(map{"method":"csv", "item-separator": " "}) > > f,f,f,f,f,f > > > Thanks! > Giuseppe > > >
Written for BaseX 9.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery