extract by delimiter

2010-12-28 Thread Thomas McGrath III
I am stuck. I've been trying to extract text from an RSS feed and so far I have the information I need but am stuck at extracting it into a better format. Here is what I have so far: location city="Bethel Park" region="PA" country="United States" units temperature="F" distance="mi" pressure="i

Re: extract by delimiter

2010-12-28 Thread Pierre Sahores
Tom, Did you try to open your RSS feed source in using TextWrangler (free) and test what can be seen in picking the "show tab stops" and "show invisibles" items from the "text options" menu item ? There is certainly something used as an (invisible?) delimiter by the RSS readers... HTH Pierre

Re: extract by delimiter

2010-12-28 Thread DunbarX
Tony. Isnt every complex "item" here delimited by the second quote? I t seems you could parse the data that way. Craig ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscript

Re: extract by delimiter

2010-12-28 Thread Warren Samples
On Tue, 2010-12-28 at 17:58 -0500, Thomas McGrath III wrote: > I am stuck. I've been trying to extract text from an RSS feed and so far I > have the information I need but am stuck at extracting it into a better > format. Here is what I have so far: > > location city="Bethel Park" region="PA"

Re: extract by delimiter

2010-12-28 Thread Colin Holgate
Can you say where the RSS feed is located? It almost looks like the problem could have been fixed at an earlier stage. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscrip

Re: extract by delimiter

2010-12-28 Thread DunbarX
Tony, If you have a field "data" with your text, and a fld "accum", then in a button somewhere: on mouseUp put fld "data" into temp set the itemdelimiter to quote repeat with y = 1 to the number of lines of temp put item 1 to 2 of line y of temp & ":" & item 3 to 4 of line

Re: extract by delimiter

2010-12-28 Thread Colin Holgate
On Dec 28, 2010, at 6:35 PM, dunb...@aol.com wrote: > You get your data parsed with colons. I tried to parse it with Colins, but > that feature is not yet supported. Being not so tall, I'm a semicolin. ___ use-livecode mailing list use-livecode@lis

Re: extract by delimiter

2010-12-28 Thread DunbarX
I see that more items need to be extracted in some lines. I see that leading spaces in some of the colon delimited items need to be removed. But the question is this: What is the best way to attack? The fun data crunching LC way, or trying, as almost everyone else has suggested, looking at the

Re: extract by delimiter

2010-12-28 Thread Mark Wieder
Colin- Tuesday, December 28, 2010, 3:41:51 PM, you wrote: > On Dec 28, 2010, at 6:35 PM, dunb...@aol.com wrote: >> You get your data parsed with colons. I tried to parse it with Colins, but >> that feature is not yet supported. > Being not so tall, I'm a semicolin. If you were supported you'd

Re: extract by delimiter

2010-12-28 Thread Colin Holgate
Try this as a starting point: replace quote&space with quote&return in fld 1 Now, with = as the itemdelimiter, the first item on each line is the label, and the second item is the value. ___ use-livecode mailing list use-livecode@lists.runrev.com Ple

Re: extract by delimiter

2010-12-28 Thread Nonsanity
If that's the block of text you have to work with, set itemdel to quote and use the odd items (delete last char) for the keys of an array, and the even items as the values. set itemdel to quote repeat with a = 1 to the number of items in mydata step 2 put word 1 to -1 of item a of myda

Re: extract by delimiter

2010-12-28 Thread Jim Ault
Try this approach, since this is an XML-like format that you need to unwind to database style. every line begins with word 1 as a category then a string of attributes as attrib="string with spaces" - working code --- on parseToArray put fld 1 into block --your data

Re: extract by delimiter

2010-12-28 Thread Mike Bonner
Its not pretty, but will this help? put field 1 into tText -- where I put your sample data put "=" & quote into tReplace replace tReplace with "=" in tText replace quote with cr in tText filter tText without empty if the last char of tText is cr then delete the last char of tText

Re: extract by delimiter

2010-12-28 Thread Mike Bonner
Wow, 300 replies while I was typing! On Tue, Dec 28, 2010 at 5:11 PM, Mike Bonner wrote: > Its not pretty, but will this help? > >put field 1 into tText -- where I put your sample data >put "=" & quote into tReplace >replace tReplace with "=" in tText >replace quote with cr in tT

Re: extract by delimiter

2010-12-28 Thread Jeffrey Massung
On Dec 28, 2010, at 3:58 PM, Thomas McGrath III wrote: > I am stuck. I've been trying to extract text from an RSS feed and so far I > have the information I need but am stuck at extracting it into a better > format. Here is what I have so far: > > location city="Bethel Park" region="PA" coun

Re: extract by delimiter

2010-12-28 Thread Mark Wieder
Jeff- Tuesday, December 28, 2010, 4:47:02 PM, you wrote: > So, most others have sent you excellent suggestions. I just find > it funny that the little town you mention just happened to be the > place I was born. ;-) You could probably save Tom a lot of trouble if you just tell him what the weath

Re: extract by delimiter

2010-12-28 Thread Thomas McGrath III
put url "http://weather.yahooapis.com/forecastrss?w=22664069&u=f"; into field 1 gets an xml like page of data. So I just extracted the yweather: info I needed: example: Then I replace "<" with "" in field 1 etc till I got the data that I was left with before -- Tom McGrath III http://lazyriv

Re: extract by delimiter

2010-12-28 Thread Thomas McGrath III
YES, that did extract what I needed and I can easily clean up the spaces and extra data. I had to read thru that five times before I saw the pattern and why it was working. At first it was like magic Now I have what I need: location city="Bethel Park" region="PA" country="United States" unit

Re: extract by delimiter

2010-12-28 Thread Thomas McGrath III
Jeff, That's awesome. I live there now. Where do you live now? (Don't tell me NJ ? I grew up in Jersey 30 years ago) -- Tom McGrath III http://lazyriver.on-rev.com 3mcgr...@comcast.net On Dec 28, 2010, at 7:47 PM, Jeffrey Massung wrote: > > On Dec 28, 2010, at 3:58 PM, Thomas McGrath III wrot

Re: extract by delimiter

2010-12-28 Thread Thomas McGrath III
By the way I tried all of the examples posted to better see what I was missing. I'm a visual oriented person and so I went with steps I could see. Only one problem in removing leading spaces, I took the lazy way out after getting confused again with multiple repeat loops etc. So here is what I

Re: extract by delimiter

2010-12-28 Thread Nonsanity
I've tested both Yahoo and Google's (undocumented) REST APIs for weather, but settled on NOAA's: http://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdXMLclient.php?lat=38.99&lon=-77.01&product=glance&begin=2010-12-28T00:00:00&end=2011-01-03T00:00:00<%20http://www.weather.gov/

Re: extract by delimiter

2010-12-28 Thread Jim Ault
To remove leading and trailing white space (space, tab...) repeat with x = 1 to the number of lines in tTemp put word 1 to -1 of line x of tTemp into line x of tTemp end repeat if line x of tTemp is quote then delete line x of tTemp [use]filter tTemp without quote

Re: extract by delimiter

2010-12-28 Thread Thomas McGrath III
Very nice Jim. Thanks for the tips. I still get hung up sometimes with the 1 to -1 . It's like my mind says isn't that like 0? Ha, and then I laugh and put it in anyway, but it is not the first thing that comes to mind. -- Tom McGrath III http://lazyriver.on-rev.com 3mcgr...@comcast.net On De

Re: extract by delimiter

2010-12-28 Thread Thomas McGrath III
Chris, I was doing just that. Testing Yahoo and then Google's api. I will check into the NOAA next. Thanks for the heads up. It puts out a lot of data over the others. I like the raw lat/long concept. It won't be more than once an hour, so that's ok. I did find the way to skip the WOEIDs and g

Re: extract by delimiter

2010-12-28 Thread Jeffrey Massung
Salt Lake City, UT of all places. Been to Jersey once, never want to revisit that experience if I can help it. I miss PA. ;-) On Dec 28, 2010, at 8:58 PM, Thomas McGrath III wrote: > Jeff, That's awesome. I live there now. Where do you live now? (Don't tell me > NJ ? I grew up in Jersey 30 year

Re: extract by delimiter

2010-12-28 Thread Jan Schenkel
--- On Tue, 12/28/10, Thomas McGrath III wrote: > > put url "http://weather.yahooapis.com/forecastrss?w=22664069&u=f"; > into field 1 > > gets an xml like page of data. So I just extracted the > yweather: info I needed: > > example: > region="PA"   country="United States"/> > > Then I replace

Re: extract by delimiter

2010-12-29 Thread Thomas McGrath III
Well I'll say hello to PA for ya! It's been typical PA weather. And the Governor is not done screwing us all yet. But other than that we have the Winter Classic coming up this weekend and the Penguins are doing pretty good and so are the Steelers but not as good as a few years ago. It's a smal

Re: extract by delimiter

2010-12-30 Thread Ken Ray
Sorry to be late to the show, but if you haven't already come up with a solution, my LiveCode-only XML Library with associated RSS plugin should make this a lot easier: XML Library: http://www.sonsothunder.com/products/xmllib/xmllib.htm RSS Plugin: http://www.sonsothunder.com/products/xml