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="http://palm.com/app.catalog.rss.extensions">
 <channel>
  <link>http://www.palm.com</link>
  <title>Device Apps for US</title>
  <description>Complete list of US Device channel applications for Palm webOS devices</description>
  <language>en-US</language>
  <pubDate>Thu, 10 Jun 2010 17:00:26 -0700</pubDate>
  <lastBuildDate>Thu, 10 Jun 2010 17:00:26 -0700</lastBuildDate>
  <ac:distributionChannel>Device</ac:distributionChannel>
  <ac:countryCode>US</ac:countryCode>
  <ac:feed_format_spec>2</ac:feed_format_spec>
<item>
<ac:localizations>
    <ac:localization ac:country="CA" ac:language="en">
     <ac:title><![CDATA[BuildaSearch]]></ac:title>
     <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, Wine.com 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:developer>Earthoid</ac:developer>
     <ac:developer_id>19427</ac:developer_id>
     <ac:developer_url>http://www.buildasearch.com</ac:developer_url>
     <ac:support_url>http://www.buildasearch.com</ac:support_url>
     <ac:categories ac:primary="Reference">
      <ac:category><![CDATA[Reference::Dictionary / Thesaurus]]></ac:category>
      <ac:category><![CDATA[Reference::Trivia / Facts]]></ac:category>
      <ac:category><![CDATA[Reference::Entertainment]]></ac:category>
     </ac:categories>
    </ac:localization>
   </ac:localizations></item>
 </channel>
</rss>

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.