Comunitatea PHP Romania
 

 
XML_Feed_Parser and Extensions

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:

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

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Top membri

Pirahna Pirahna
la birou
carco carco
Bucuresti
Birkoff Birkoff
Bucuresti
mihaitha mihaitha
Sibiu
Mascka Mascka
Braila
gabysolomon gabysolomon
Bacau
whooper whooper
Toronto ON
raul_ raul_
dechim dechim
Drobeta Turnu Severin
Amenthes Amenthes

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Garcia Marquez | Charity | Shopping and Product Reviews | Web Advertising | Car Accident Attorney Los Angeles
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis