CSV import considerations

Tomaz Canabrava tcanabrava at kde.org
Tue Sep 17 05:24:02 UTC 2013


On Tue, Sep 17, 2013 at 8:28 AM, Dirk Hohndel <dirk at hohndel.org> wrote:

> On Tue, 2013-09-17 at 08:55 +0300, Miika Turkia wrote:
> > We have had some requests for importing CSV formatted dive logs and
> > therefor I have done some reading on the possibility of converting
> > them with our current import framework (XSL transformations). So far I
> > have only read about parsing CSV with XSLT and have done no testing
> > whatsoever.
> >
> > It seems that with XSLT1 (what we use currently) it might be possible
> > to read CSV files only if the file is modified to include XML tags
> > around the CSV part. This path does sound quite a kludge since we
> > would need to hack the input file first to include XML tags and then
> > parse it with XSLT. And that transformation is not really supported in
> > XSLT1, even though it seems that it might be possible.
> >
> http://stackoverflow.com/questions/8119779/how-to-write-a-csv-parser-using-xslt-1-0
>
> Well, it should be easy enough to recognize a CSV file. Once you have
> that, you can simply add the tags in the memory buffer and hand the
> modified buffer over to XSLT1, right?
>
> > XSLT2 does support reading in "raw" files and should be able to parse
> > them to XML. Drawback in XSLT2 is that it is not well supported so it
> > seems like a no-go.
> > http://andrewjwelch.com/code/xslt/csv/csv-to-xml_v2.html
> > http://rosettacode.org/wiki/Csv-to-xml.xslt
> >
> I have trouble enough with marble (still not solved), I don't want to
> add another ill-supported dependency if I can avoid it...
>

Marble it's not ill supported. I need a victim with a Mac computer to
comppile this in the correct way.
=(



> >
> > Parsing the CSV in C is doable but of course scripting languages like
> > perl or python are a lot more flexible when it comes to parsing
> > strings and outputting XML. But then again these script languages are
> > not universal, especially one cannot assume them to be available on
> > Windows (even though they can be installed there).
>
> No other scripting language dependency, please.
>
> > Does anyone else have an insight on a solution that would fit us? Or
> > any other comments on the ones I listed here?
>
> What about my suggestion above?
>
> /D
>
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130917/c18ed2aa/attachment-0001.html>


More information about the subsurface mailing list