Re: Add JSON, XML, CSV to Baby X resource compiler

Liste des GroupesRevenir à l c 
Sujet : Re: Add JSON, XML, CSV to Baby X resource compiler
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.c
Date : 20. May 2024, 10:46:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240520114601.00006c64@yahoo.com>
References : 1 2
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Sun, 19 May 2024 23:41:36 +0100
bart <bc@freeuk.com> wrote:

On 19/05/2024 11:16, Malcolm McLean wrote:
The Baby X resource compiler takes data - fonts, images, audio,
strings
- and converts them into C source so that they can be read by C
programs without relying on external data files.
 
An obvious extension is to take in structured data. Adding SQL and
querying a database would unfortuately mean extending the program
so that it could only run on a large machine with a SQL server
running, and isn't really a viable proposition. However JSON, XML,
and CSV are commonly used to pass small to medium amounts of data
about.
 
I've made a start on supporting CSV with the "<dataframe>" tag. CSV
data is tabular and two dimensional, and lends itself to an arrray
of simple structures. JSON And XML can of course represent more
complex data, with hierarchy. The dataframe tag is still very
experimental. I've never used it for anything practical.
 
So what would be the best approach to putting in JSON and XML
support? 
 
I've only briefly used XML.
 
The problem with XML is that the data it represents is not just
hierarchical, but it can be chaotic. You can have one lot of data,
followed by another for something else with a different structure,
followed by other. It is just a container for disparate sets of data.
 
Even if the file does represent a simple list of records for example,
you won't know that without reading it and analysing it.
 

JSON is about the same.

I looked online at an XML to CSV converter, which I thought would do
something clever, but it seems to just turn each XML line into one
string per line.
 
Maybe it doesn't matter; the user of your program knows what's in
their XML file, and will know what to do with the different bits.
It's their problem.
 
But you still have to figure out how to represent an arbitary data
structure as C data. Plus you have to deal with tag names, and
attributes.
 
Personally, I would suggest using converters (ones clever than the
CSV one I tried) to turn XML files into better-organised formats
first.
 
 
 
 



Date Sujet#  Auteur
19 May 24 * Add JSON, XML, CSV to Baby X resource compiler10Malcolm McLean
20 May 24 `* Re: Add JSON, XML, CSV to Baby X resource compiler9bart
20 May 24  +- Re: Add JSON, XML, CSV to Baby X resource compiler1Michael S
20 May 24  +* Re: Add JSON, XML, CSV to Baby X resource compiler3Mikko
20 May 24  i`* Re: Add JSON, XML, CSV to Baby X resource compiler2Malcolm McLean
21 May 24  i `- Re: Add JSON, XML, CSV to Baby X resource compiler1Mikko
20 May 24  `* Re: Add JSON, XML, CSV to Baby X resource compiler4bart
21 May 24   +* Re: Add JSON, XML, CSV to Baby X resource compiler2Malcolm McLean
22 May 24   i`- Re: Add JSON, XML, CSV to Baby X resource compiler1Ben Bacarisse
25 May 24   `- Re: Add JSON, XML, CSV to Baby X resource compiler1Malcolm McLean

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal