For your reading convenience, I have divided this question into two versions: The short version and the long version. One is just a question with no clarification and the other has examples and things.
Short version of the question:
I want to be able to take two known (static) strings and pull out the information between those two strings without having to explode the bigger string 20 times before I'm left with just the information I want.
Long version of the question:
I'm trying to parse an XML file (specifically an RSS feed) into little blocks of information that will get dropped into a database.
Now, for the example:
Incoming RSS:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Foods and Stuff</title>
<link>http://www.foodexample.com</link>
<atom:link type="application/rss+xml" rel="self" href="http://foodexample.com/user/758392/posts.rss"/>
<description>Food Updates from Ed</description>
<language>en-us</language>
<ttl>40</ttl>
<item>
<title>Affogato at Lil Oven. Delicious.</title>
<category>Deserts</category>
<pubDate>Mon, 17 Aug 2009 11:07:59 +0000</pubDate>
<link>http://foodexample.com/user/758392/3359886510</link>
</item>
<item>
<title>Ice Cream at TCBY</title>
<category>IceCream</category>
<pubDate>Mon, 17 Aug 2009 11:07:59 +0000</pubDate>
<link>http://foodexample.com/user/758392/3359847568</link>
</item>
<item>
<title>Hamburger Steak Plate Lunch at LikeLike Drive-Inn</title>
<category>PlateLunch</category>
<pubDate>Mon, 17 Aug 2009 11:07:59 +0000</pubDate>
<link>http://foodexample.com/user/758392/3359827490</link>
</item>
</channel>
</rss>
Code: Select all
<item>
<title>Affogato at Lil Oven. Delicious.</title>
<category>Deserts</category>
<pubDate>Mon, 17 Aug 2009 11:07:59 +0000</pubDate>
<link>http://foodexample.com/user/758392/3359886510</link>
</item>
<item>
<title>Ice Cream at TCBY</title>
<category>IceCream</category>
<pubDate>Mon, 17 Aug 2009 11:07:59 +0000</pubDate>
<link>http://foodexample.com/user/758392/3359847568</link>
</item>
<item>
<title>Hamburger Steak Plate Lunch at LikeLike Drive-Inn</title>
<category>PlateLunch</category>
<pubDate>Mon, 17 Aug 2009 11:07:59 +0000</pubDate>
<link>http://foodexample.com/user/758392/3359827490</link>
</item>
id // title // category // pubDate // link
45 // Affogato at Lil Oven // Deserts // Mon, 17 Aug 2009 11:07:59 +0000 // http://foodexample.com/user/758392/3359886510
46 // Ice Cream at TCBY // IceCream // Mon, 17 Aug 2009 11:07:59 +0000 // http://foodexample.com/user/758392/3359847568
47 // Hamburger Steak Plate Lunch... // Plate Lunch // Mon, 17 Aug 2009 11:07:59 +0000 // http://foodexample.com/user/758392/3359827490
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Thank you for any help you guys might have to offer. If nothing else, I'd love to be pointed in the right direction. I don't expect the full code for this to function, as I can write php fine....just can't figure out what function this is...
ps: of course, i can explode everything...but like every good explosion, i'll just end up with bits everywhere.
~kykin