Page 1 of 1

text file to xml- for use as annotation object

Posted: Tue Dec 06, 2011 5:39 pm
by alder_blight
Hi, i've got kind of an embarrassing question, but i'll swallow my pride and ask anyway. I have a txt file that has all the info i need, but i'm having trouble getting it into the correct format (xml, etc.). It was suggested i use a php script to do this, but that's sadly a bit out of my league. The txt file looks like this:

"incident_id:INTEGER sex:STRING race:STRING age:INTEGER fname:STRING
lname:STRING 7 M B 26 Samuel Schley 8 M B 28 Allan Atkins 9 M B 17 Kenny
Mcclinton 10 M B 31 Kendrick Brewley 12 M B 20 Shawn Halliburton 14 M B"

etc.etc.etc



Is there a simple way to get this formatted into xml or sqlite? A complex way would be fine too...i'm more than willing to learn.

Thanks!!

Re: text file to xml- for use as annotation object

Posted: Tue Dec 06, 2011 11:10 pm
by s.dot
Is the text file in a consistent format? You will have to parse the file to break it up into the info you need and then probably write an xml string directly or use SimpleXML class.