Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:33:01+00:00 2026-05-26T12:33:01+00:00

I’m working on implementing a feed generator for use with Google Product Search for

  • 0

I’m working on implementing a feed generator for use with Google Product Search for our sites. As Zend incorporates a feed writer class, I decided to go with Atom for the feed format.

I’ve done some work building up a bare-bones Atom feed into which the real product data will be injected, but I’ve hit a fairly serious snag.

Google want a feed file to be a customised version of either RSS or Atom, with an additional namespace attached for the tags Google Product Search uses. For example, <feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">. I’ve been trying to figure out how to attach the additional namespace and use it in generating the feed, but Zend’s documentation on the matter is vague at best, mentioning something about extensions without going into any great detail.

I did also find mention in the documentation of registering namespaces to zend_feed, so I tried Zend_Feed::registerNamespace ('g', 'http://base.google.com/ns/1.0') to attach the needed namespace, but this didn’t appear to do anything.

So how do I add additional namespaces to a zend feed? Does it require subclassing the zend_feed_writer_feed? is there some kind of plugin system that allows this? Or do I just need to register the namespace somehow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:33:01+00:00Added an answer on May 26, 2026 at 12:33 pm

    Extend from Zend_Feed_Atom and add:

    class Gordons_Feed_Atom extends Zend_Feed_Atom {
         protected function _mapFeedHeaders($array) {
             $feed = parent::_mapFeedHeaders($array);
             $feed->setAttribute('xmlns:g', '"http://base.google.com/ns/1.0');
             return $feed;
         }
    }
    

    Update:

    You will have to override the _mapFeedEntries function and then add the entries as the others are added:

        $cond = $this->_element->createElement('g:condition');
        $cond->appendChild($this->_element->createCDATASection($dataentry->gcondition));
        $entry->appendChild($cond);
    

    You could always do this:

    protected function _mapFeedEntries(DOMElement $root, $array)
    {
        parent::_mapFeedEntries($root, $array);
        foreach($array as $dataentry) {
            //Add you're custom ones
            $cond = $this->_element->createElement('g:condition');
            $cond->appendChild($this->_element->createCDATASection($dataentry->gcondition));
            $entry->appendChild($cond);
        } 
    }
    

    That function would ensure you get the standard ones and then you’re custom ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.