ZF-2140: Zend_Feed (RSS) Does Not Provide Access To <content:encoded>

Description

Zend_Feed::RSS does not provide access to the data of each RSS feed item. This is the main item holding the XHTML content of each RSS item in a feed. From what i can tell, the code attempts to parse it, but either provides no mechanism to access it (i.e. $item->content()) or improperly parses it such that that block is always returned as "".

You should be able to do:

$item->content() and get the xhtml content of the tag. Without this ability, parsing most RSS feeds becomes essentially useless.

Comments

This isn't really a bug, more a usability issue.

$item->content() will always be empty because content is the namespace.

$item->encoded() returns the value of because the actual element is - basically the parser strips the namespace.

Altering this behaviour would be a bad idea since we should always have access to $item->encoded() to ensure consistency within the system.

This definitely needs documenting more clearly to ensure no confusion with this, or other namespaces.

However we should consider setting up an alias so that $item->content() will return to ensure consistency with feed creation (we set using $dataentry->content currently)

So not broken, and not very serious, but a serious contender for a feature enhancement to maximise consistency and minimise confusion.

Meh, shouldn't make such suggestions without offering up a patch I guess...

There is a workaround (actually the correct usage), so this seems like a should have- or maybe even a nice-to-have- to me. Perhaps we should log another issue for fixing the docs in 1.0.4 for this, and creating the alias (and updating the docs) for 1.5. Simone, what do you think? And will you be able to get to this in the next couple of days if you intend to fix it. If not, please unassign it since we are getting very close to the code freeze dates for 1.0.4 and 1.5 RC1.

Thanks. ,Wil

The patch is ready since the beginning of February but I haven't created consistent test cases yet. I will take the time to fix it until tomorrow. If not, I will unassign it and follow your suggestions. :)

Hi Wil, I just noticed the example in the English documentation is incomplete.

The code is missing the __call implementation.


    public function __call($var, $unused)
    {
        switch ($var) {
            case 'myUpdated':
                // Translate myUpdated to myns:updated.
                return parent::__call('myns:updated', $unused);

            default:
                return parent::__call($var, $unused);
            }
    }

Additionally, I would change


<?php
$entry = new MyEntry();
$entry->myUpdated = '2005-04-19T15:30';

into



<?php
$entry = new MyEntry();
$entry->myUpdated = '2005-04-19T15:30';

// method style call is handled by __call function
$entry->myUpdated();  
// property style call is handled by __get function
$entry->myUpdated;

Because English it not my mother language could you please give a check to the modification above and let me know if they are grammatically corrected?

fixed in r7933. I wait a feedback on my previous comment before closing the issue.

If you're talking about the comments in the PHP code, they all look good to me. The only minor comment is that I would write method-style and property-style instead of 'method style' and 'property style'.

definitely closed in r8008