I Need a Human Readable, Yet Parse-able Document Format
- by macinjosh
I'm working on one of those projects where there are a million better ways to accomplish what I need but I have no choice and I have to do it this way. Here it is:
There is a web form, when the user fills it out and hits a submit a human readable text file is created using the form data. It looks like this:
field_1: value for field one
field_2: value for field two
more data for field two (field two has a newline in it!)
field3: some more data
My problem is this: I need to parse this text file back into the web form so that the user can edit it.
How could I, in a foolproof way, accomplish this? A database is not an option, I have to use these text files.
My Questions:
Is there a foolproof way to do this using the format in the example above?
What human readable format would work better (in other words I can change the format)
Human readable means that a non programmer could read it and know what is what.
This project uses PHP.