Traling empty nodes in csv:serialize

Saturday, 22 March 2014 · 4 messages
LJ
Lars Johnsen22 Mar 2014 10:50 #
Hi all I have a question about csv:serialize and blank nodes. Trailing blanks are indicated with a separator, but those in the middle are.
     csv:serialize(
     <rows>
        <row> <f>1</f> <s>2</s> <t>3</t></row>
        <row> <f></f>  <s></s>  <t>3</t></row>
        <row> <f>1</f> <s></s>  <t>3</t></row>
        <row> <f>1</f> <s></s>  <t></t></row>
        <row> <f>1</f> <s>2</s> <t></t></row>
     </rows>)
Here is the output (BaseX 7.8.1) , where line 4 and 5 are missing trailing separators: 1,2,3 ,,3 1,,3 1 1,2 Could this be fixed, or is it a feature? All the best Lars G Johnsen National Library of Norway
CG
Christian Grün22 Mar 2014 12:48 #
Hi Lars, this behavior is a feature indeed, because the empty strings don't contribute to the result. Do you encounter any problems when processing the resulting CSV output? If yes, we could have another look at this. Best, Christian
Quoted text · Lars Johnsen · 33 lines
> I have a question about csv:serialize and blank nodes. Trailing blanks are > indicated with a separator, but those in the middle are. > > csv:serialize( > <rows> > <row> <f>1</f> <s>2</s> <t>3</t></row> > <row> <f></f> <s></s> <t>3</t></row> > <row> <f>1</f> <s></s> <t>3</t></row> > <row> <f>1</f> <s></s> <t></t></row> > <row> <f>1</f> <s>2</s> <t></t></row> > </rows>) > > Here is the output (BaseX 7.8.1) , where line 4 and 5 are missing trailing > separators: > > 1,2,3 > ,,3 > 1,,3 > 1 > 1,2 > > Could this be fixed, or is it a feature? > > All the best > Lars G Johnsen > National Library of Norway > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
HR
Hans-Juergen Rennau22 Mar 2014 13:08 #
If I may add a comment - I find it counter-intuitive to skip the trailing separators. What I expect from CSV data is strict uniformity, every line same number of cells. This has also a (though modest) control effect, like a a minimalistic checksum: deviations from the expected number of cells indicate errors. And I have not yet encountered a different behaviour when downloading public data. (Maybe one may take different views of CSV, but they have not yet occurred to me.) I wonder if there is an advantage gained by the present behaviour. Kind regards, Hans-Juergen --------------------------------------------
Quoted text · Christian Grün · 1 line
Christian Grün <christian.gruen at gmail.com> schrieb am Sa, 22.3.2014:
Betreff: Re: [basex-talk] Traling empty nodes in csv:serialize An: "Lars Johnsen" <yoonsen at gmail.com> CC: "BaseX" <basex-talk at mailman.uni-konstanz.de> Datum: Samstag, 22. März, 2014 12:48 Uhr Hi Lars, this behavior is a feature indeed, because the empty strings don't contribute to the result. Do you encounter any problems when processing the resulting CSV output? If yes, we could have another look at this. Best, Christian
Quoted text · Christian Grün · 1 line
> I have a
question about csv:serialize and blank nodes. Trailing
Quoted text · Christian Grün · 2 lines
blanks are > indicated with a separator,
but those in the middle are.
Quoted text · Christian Grün · 4 lines
> > csv:serialize( > <rows> > <row>
 <f>1</f> <s>2</s>
 <t>3</t></row>
Quoted text · Christian Grün · 1 line
>
      <row> <f></f>
 <s></s>  <t>3</t></row>
Quoted text · Christian Grün · 1 line
> <row>
 <f>1</f> <s></s>
 <t>3</t></row>
Quoted text · Christian Grün · 1 line
>
      <row> <f>1</f>
 <s></s>  <t></t></row>
Quoted text · Christian Grün · 1 line
> <row>
 <f>1</f> <s>2</s>
 <t></t></row>
Quoted text · Christian Grün · 1 line
>
 </rows>)
Quoted text · Christian Grün · 2 lines
> >
Here is the output (BaseX 7.8.1) , where line 4 and 5 are
Quoted text · Christian Grün · 10 lines
missing trailing > separators: > > 1,2,3 > ,,3 > 1,,3 > 1 > 1,2 > > Could this be fixed,
or is it a feature?
Quoted text · Christian Grün · 3 lines
> > All the best > Lars G
Johnsen
Quoted text · Christian Grün · 4 lines
> National Library of Norway > > >
_______________________________________________
Quoted text · Christian Grün · 4 lines
> BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
_______________________________________________ BaseX-Talk mailing list BaseX-Talk at mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CG
Christian Grün22 Mar 2014 13:50 #
Thanks for your assessment. The CSV output of the latest snapshot [1] should now contain all trailing delimiters. [1] http://files.basex.org/releases/latest/
Quoted text · Hans-Juergen Rennau · 87 lines
On Sat, Mar 22, 2014 at 1:08 PM, Hans-Juergen Rennau <hrennau at yahoo.de> wrote: > If I may add a comment - I find it counter-intuitive to skip the trailing separators. What I expect from CSV data is strict uniformity, every line same number of cells. This has also a (though modest) control effect, like a a minimalistic checksum: deviations from the expected number of cells indicate errors. And I have not yet encountered a different behaviour when downloading public data. (Maybe one may take different views of CSV, but they have not yet occurred to me.) I wonder if there is an advantage gained by the present behaviour. > > Kind regards, > Hans-Juergen > > > -------------------------------------------- > Christian Grün <christian.gruen at gmail.com> schrieb am Sa, 22.3.2014: > > Betreff: Re: [basex-talk] Traling empty nodes in csv:serialize > An: "Lars Johnsen" <yoonsen at gmail.com> > CC: "BaseX" <basex-talk at mailman.uni-konstanz.de> > Datum: Samstag, 22. März, 2014 12:48 Uhr > > Hi Lars, > > this behavior is a feature > indeed, because the empty strings don't > contribute to the result. > > Do you encounter any problems when processing > the resulting CSV > output? If yes, we could > have another look at this. > > Best, > Christian > > > > I have a > question about csv:serialize and blank nodes. Trailing > blanks are > > indicated with a separator, > but those in the middle are. > > > > csv:serialize( > > <rows> > > <row> > <f>1</f> <s>2</s> > <t>3</t></row> > > > <row> <f></f> > <s></s> <t>3</t></row> > > <row> > <f>1</f> <s></s> > <t>3</t></row> > > > <row> <f>1</f> > <s></s> <t></t></row> > > <row> > <f>1</f> <s>2</s> > <t></t></row> > > > </rows>) > > > > > Here is the output (BaseX 7.8.1) , where line 4 and 5 are > missing trailing > > separators: > > > > 1,2,3 > > ,,3 > > 1,,3 > > 1 > > 1,2 > > > > Could this be fixed, > or is it a feature? > > > > All the best > > Lars G > Johnsen > > National Library of Norway > > > > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery