XML_Feed_Parser and Extensions

XML_Feed_Parser and Extensions – Handling extensions with XML_Feed_Parser

Description

Using XML namespaces, the various syndication formats are very easy to extend and the number of extensions in use is enormous.

XML_Feed_Parser focuses on core functionality shared between the various syndication formats. Some of the most common extensions are handled natively—particularly when they provide one format with features to bring it into line with others, such as the content extension for RSS2—but the majority provide specialist content and providing support for them would quickly result in a bloated package.

It is possible that a proper extensions mechanism may be introduced in a future version, but as an alternative the DOM models in use within the classes are publicly accessible, allowing the package to be wrapped with special handlers.

For example, to make use of the 'pheed' extension (namespace http://www.pheed.com/pheed/) we might use:

<?php
$feed 
= new XML_Feed_Parser($xml_source);
$entry $feed->getEntryByOffset(0);
$eModel $entry->model;

$thumbnails $eModel->getElementsByTagNameNS(
    
'http://www.pheed.com/pheed/''thumbnail');

if (
$thumbnails->length) {
    
$thumbnail_url $thumbnails->item(0)->nodeValue;
}
?>
Overview of XML_Feed_Parser (Previous) XML_Parser (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.