Good conventions for embedding schema of a flat file

Posted by Ville Koskinen on Stack Overflow See other posts from Stack Overflow or by Ville Koskinen
Published on 2010-03-21T17:53:59Z Indexed on 2010/03/21 18:01 UTC
Read the original article Hit count: 270

We receive lots of data as flat files: delimitted or just fixed length records. It's sometimes hard to find out what the files actually contain.

Are there any well established practices for embedding the schema of the file to the beginning or the end of a file to make the file self-explanatory?

Just to get an idea, imagine something like this:

<data name=test records=2 type=fixed>
   <field name=foo start=0 length=2 type=numeric>
   <field name=bar start=2 length=4 type=text>
</data>
11test
12ing 

We would parse the xml in the beginning and use it for reading the records.

© Stack Overflow or respective owner

Related posts about metadata

Related posts about flat-file