T
The Frog
Hi Everyone,
Before I begin trudging away at this I thought it prudent to ask for
some advice. I have a legacy file format from an application that is
common to both the company I work for and the business partners. The
file is a 'sort of' structured, in that it is text based, and there
are paragraphs of information, each following its own structural bent.
I am going to write a parser for this file type so that we can do more
than we are currently limited to with the existing application. My
question is therefore: What would be an 'elegant' approach to reading
this file and its various parapgraphs? An example is below....
<This is a 'blank slate' file>
PROSPACE SCHEMATIC FILE
; Version 2006.3.2
Project,Space Planning-Projekt,,
0,,7,1.5,1.5,1,1,0,,1,0,0,0,0,0,3,1,1,0,1,0,0,0,0,2,3,1,0,1,0,0,0,0,3,3,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,2,,0,0,0,0,0,0,0,0,,,0,
<This is with some basic data in it>
PROSPACE SCHEMATIC FILE
; Version 2006.3.2
Project,Space Planning-Projekt,,
0,,7,1.5,1.5,1,1,0,,1,1,0,0,0,0,3,1,1,0,1,0,0,0,0,2,3,1,0,1,0,0,0,0,3,3,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,2,,0,0,0,0,0,0,0,0,,,0,
Planogram,Test,,
100,200,60,16777215,2,1,100,10,60,1,16777215,0,10,2,0,32896,1,0,0,1,0,,,-1,-1,-1,-1,0,0,0,-1,-1,-1,-1,-1,-1,0,0,0,-1,-1,-1,-1,-1,-1,0,0,0,-1,-1,0,1,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,1,,,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,,,,0,0,0,0,0,0,0,0,,,,0.5,30,30,0,0,0,0,0,0,1.5,1.5,1,1,0,0,0,0,0,0,0,0,,,,,,F766F39C-5610-4ced-
AB0A-FDFD4D6DC166,,,,,0
Segment,,,
0,100,0,0,0,0,0,0,0,0,0,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,,
What I am hoping to do is to eliminate the need to do a brute force
approach. I was hoping that perhaps someone might have a suggestion
using regular expressions. The goal at this stage is to read the file
and place the data into suitable class objects with some sort of
heirarchy. I understand the elements themselves (or mostly,
unfortunately there is no official documentation for the file type),
so interpreting the values into suitable objects isnt the issue, its
reading the file in the first place and isolating those entities from
the text in a 'clean' way.
Any advice would be greatly appreciated.
The Frog
Before I begin trudging away at this I thought it prudent to ask for
some advice. I have a legacy file format from an application that is
common to both the company I work for and the business partners. The
file is a 'sort of' structured, in that it is text based, and there
are paragraphs of information, each following its own structural bent.
I am going to write a parser for this file type so that we can do more
than we are currently limited to with the existing application. My
question is therefore: What would be an 'elegant' approach to reading
this file and its various parapgraphs? An example is below....
<This is a 'blank slate' file>
PROSPACE SCHEMATIC FILE
; Version 2006.3.2
Project,Space Planning-Projekt,,
0,,7,1.5,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,1,,,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,,,,0,0,0,0,0,0,0,0,,,,0.5,30,30,0,0,0,0,0,0,1.5,1.5,1,1,0,0,0,0,0,0,0,0,,,,,,F766F39C-5610-4ced-
AB0A-FDFD4D6DC166,,,,,0
Segment,,,
0,100,0,0,0,0,0,0,0,0,0,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,,
What I am hoping to do is to eliminate the need to do a brute force
approach. I was hoping that perhaps someone might have a suggestion
using regular expressions. The goal at this stage is to read the file
and place the data into suitable class objects with some sort of
heirarchy. I understand the elements themselves (or mostly,
unfortunately there is no official documentation for the file type),
so interpreting the values into suitable objects isnt the issue, its
reading the file in the first place and isolating those entities from
the text in a 'clean' way.
Any advice would be greatly appreciated.
The Frog