PEAR Manual
Prev |  | Next

# 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 focusses 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:

    $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;
    }

Prev | Home | Next
Introduction and Quick Start | Up | XML_Parser