Consolidating Multiple RSS Feeds!? - Problem with Multiple Layouts!?

Can u help.
I have multiple RSS feeds I need to parse ... but each RSS feed has a slightly different XML layout and I - frankly - have no idea how best to tackle the stripping / parsing into a consolidated / standard loop!?

these rss feeds, for example;

http://www.guardian.co.uk/rssfeed/0,,1,00.xml
- has this variable when XMLparsed using CF;

: rdf:RDF.item[i].title

http://michellemalkin.com/index.xml
- has this variable when XMLparsed using CF;

: rss.channel.item[i].title



Is there a way to call the 'item[i].title' part of each parsed XML variable ... as a standard call without having to hard code each RSS feed's unique XML structure individually? You see ... the RSS feed URLS are fed dynamically from my web site ... and hardcoding would be impossible.

Thanks!
R



rcbuchananAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PluckaCommented:
rcbuchanan,

Use XmlSearch which is CF's version of XPath, search for XPath queries to assist you.

    <cfset myXml = XmlParse(xmlVariable) />
    <cfset nodes = xmlSearch(configXml, "//items/*") />
    <cfdump var="#nodes#" />

This should return all items from your xml.        

Regards
Plucka
rcbuchananAuthor Commented:
Thanks. BUT ... problem - when I use xmlsearch ... the multiple rss.channel.item[i].title values ... aren't placed into an array. ..

instead ... the multiple sub components of item[i] are sequentially listed; ..

i.e. item[1].xmltext = title
i.e. item[2].xmltext = description
i.e. item[3].xmltext = text

etc

instead ... i need ...
item[1].title.xmltext
item[2].title.xmltext
item[3].title.xmltext


make sense!?
Richard
PluckaCommented:
Just loop through them and build your array.

<cfif item[x].XmlName eq "title">
    <cfset item[y].title = item[x].XmlText />

Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

PluckaCommented:
Xsearch can get just the titles also, if that's what your after.

I'd have to look up how.
PluckaCommented:
Try

    <cfset myXml = XmlParse(xmlVariable) />
    <cfset nodes = xmlSearch(configXml, "//title/*") />
    <cfdump var="#nodes#" />

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rcbuchananAuthor Commented:
Plucka:
Thanks. This kinda works.  Problem : each RSS feed has different naming conventions and different XML structure.

How on earth do these RSS aggregators like NetNewsWire understand which fields to strip; for blog title, description and date!? I'm perplexed.

R
rcbuchananAuthor Commented:
thanks. found solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.