Source for file unserializeRDF.php
Documentation is available at unserializeRDF.php
* This example shows how to create any object
* from an XML document. In this case we get
* some aggregated objects for channel and items
* @author Stephan Schmidt <schst@php.net>
require_once 'XML/Unserializer.php';
* class for the RDF docuemnt
* class that is used for a channel in the RSS file
* you could implement whatever you like in this class,
* properties will be set from the XML document
* class that is used for an item in the RSS file
* you could implement whatever you like in this class,
* properties will be set from the XML document
'rdf:RDF' => 'rdfDocument', // this is used to specify a classname for the root tag
// be careful to always use the ampersand in front of the new operator
$status = $unserializer->unserialize('http://pear.php.net/feeds/latest.rss',true );
if (PEAR ::isError ($status)) {
echo 'Error: ' . $status->getMessage ();
$rss = $unserializer->getUnserializedData ();
echo 'This has been returned by XML_Unserializer:<br>';
echo '<br><br>Root Tagname: '. $unserializer->getRootName (). '<br>';
$items = $rss->getItems (3 );
echo '<br>Titles of the last three releases:<br>';
foreach ($items as $item) {
echo 'Title : '. $item->getTitle(). '<br>';
Documentation generated on Mon, 11 Mar 2019 15:41:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|