converting textfiles to xml???

Got an idea, post it here

converting textfiles to xml???

Postby Mr_T on Wed Oct 20, 2004 7:37 am

Is there a way to convert textfile recipes from ex. mealmaster to an xml- database???
I found a good source for this on the net
http://www.ffts.com/recipes.htm

All the recipes are devided by the same dividers
start of recipe: MMMMM----- Recipe via Meal-Master (tm) v8.01
Recipe goes in here
end of recipe : MMMMM

//Otto
Mr_T
 
Posts: 37
Joined: Sun Jan 18, 2004 7:44 pm
Location: Sweden

Postby antipasto on Thu Oct 21, 2004 7:25 pm

If you want to do this in just a one-off way, then there's lots of good ways to deal with this quickly... MS Excel is one of the most intuitive data manipulation programs, you can be pretty creative with it to work out patterns with columns and search & replace, and fill-down.

Notepad, regular expressions (grep), or perl are a good place to start.

If this is something you want to do often from an online updated source, then you need to investigate not only perl, but specifically XSL... XSL is a language or applying styles or transforming XML documents... I've seen samples of XSL stylesheets that change a text file (once you've added <xml> to the beginning and </xml> to the end of the file) to just about any XML format you want.

I have an XSL plugin at http://writtorrent.sf.net for Xlobby... you could use it to programatically apply an XSL (included are some RSS -> Xlobby DB XSL stylesheets that could help) with a click of a button in Xlobby.
antipasto
 
Posts: 44
Joined: Fri May 07, 2004 10:35 pm