I have to huge array of 2D-points and some small associated data to file. File will be used by third person and user would like to use this file as input to his program. So user needs to parse file’s contents in his program.
I’d like to use file format that is kind of readable and self-documenting like XML. But using XML for this will make the file at least 3 times larger.
So is there a common way to write such data so that users could easily understand it?
Note that there is a couple of entries of additional data that are more complex than 2D-points.
Any suggestions will be appreciated.
EDIT: The question is not how to parse file but how to write file so that it could be parsed intuitively.
EDIT 2: To be more specific: I’m writing simple emulator of 3D-scene with N points and N cameras, so for each time moment I need to store 2D-projection of each point for each camera. Of course, camera position and orientation need to be stored in the same file.
You can read line by line and use a regex to check whether there is a 2D coordinate or other kind of information on that line, and use it in your program.
EDIT:
I would suggest an input file like the following:
Where:
It should be easy to read this, because you define the number of points per camera. With StringTokenizer (in Java at least), you can easily split the strings, to get the data you want.