text file to xml- for use as annotation object

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alder_blight
Forum Newbie
Posts: 1
Joined: Tue Dec 06, 2011 5:23 pm

text file to xml- for use as annotation object

Post 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!!
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

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

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply