[nycphp-talk] Parsing Fun
Christopher Greeley
tgrza at grza.com
Sun Aug 22 23:41:23 EDT 2004
I have been experimenting with parsing, as I am, and have always been
(regardless of the programming language) in the dark on exactly how I should
be going about parsing a text file. I have always kept it simple with easy
explodes and the like, but it is getting to the point where I want to have a
smarter script that doesn't need a finite list of things that must come in a
certain order, etc. So, to that end, I have been experimenting with parsing
some RSS streams (I am using the Reuters Sports Stream at
http://www.microsite.reuters.com/rss/sportsNews as a guinea pig). I thought
that for this end, sscanf would be really easy - I basically got the
position of two tags I wanted to read in between with strpos, used substr to
truncate the string, and then attempted to use sscanf to parse it into neat
little variables. The problem I ran into is that sscanf doesn't really like
white spaces, and it stops reading at that point. So, I dug around a little
and found that someone had used %[^[]] to match everything - but at this
point, sscanf stopped following my handy little outline.
So, this is more of a request for some general direction in gaining some
parsing skills - I am sure there are some out there with some weaker skills
who could use the brush up as well.
Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20040822/f49fb6f2/attachment.html>
More information about the talk
mailing list