Trying to figure out how to parse the attribute value from an RSS feed which contains namespaces? Need to retrieve value "CA" from 'ac:country="CA"' in the code below.

Thanks In Advance!

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:ac="">
  <title>Device Apps for US</title>
  <description>Complete list of US Device channel applications for Palm webOS devices</description>
  <pubDate>Thu, 10 Jun 2010 17:00:26 -0700</pubDate>
  <lastBuildDate>Thu, 10 Jun 2010 17:00:26 -0700</lastBuildDate>
    <ac:localization ac:country="CA" ac:language="en">
     <ac:summary><![CDATA[BuildaSearch is the ultimate search solution. Sleek look and feel. Totally customize your search experience. Yahoo!, Yahoo! News, Bing, Bing News, Google, Google News, Google Images, Twitter, Indeed, Dictionary, Shoutcast Radio, Oodle classifieds, App Cat, and US/ World weather in one easy to use search tool. Search the web using the big three search engines. Catch the latest gossip using real-time Twitter search. Search for jobs using Indeed. Search millions of classifieds using Oodle. Find and listen to music via Shoutcast Radio. Other features include: 80% more viewing space, custom colors, and regional search for Yahoo!, Bing, Google, Oodle and Indeed. New in version 1.0.9: minor fixes, spelling suggestion, regional search for Canada, UK, US, Ireland, and India. Search Away!]]></ac:summary>
     <ac:price ac:currency="CAD">1.89</ac:price>
     <ac:categories ac:primary="Reference">
      <ac:category><![CDATA[Reference::Dictionary / Thesaurus]]></ac:category>
      <ac:category><![CDATA[Reference::Trivia / Facts]]></ac:category>

Recommended Answers

All 4 Replies

What are you using to pass the XML? Which PHP library?

I am using SimpleXML, but can use DOM if that is what your recommend.

I am able to parse xml namespaces but have problems parsing data from namespace attributes found in the above file. Would like to parse/ retrieve "CA" from Line 15 "<ac:localization ac:country="CA" ac:language="en">"

Thanks for help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.