Example

Example – Example for the usage of XML_RDDL

Usage example

As the RDDL website contains RDDL resources embedded in the XHMTL code of the home page, it can be used in the following example.

Fetching resources from www.rddl.org

<?php
require_once "XML/RDDL.php";

// create new RDDL parser
$rddl   = &new XML_RDDL();

// parse a document that contains RDDL resources
$result $rddl->parseRDDL('http://www.rddl.org');
// check for error
if (PEAR::isError($result)) {
echo    
sprintf"ERROR: %s (code %d)"$result->getMessage(), $result->getCode());
exit;
}

// get all resources
$resources $rddl->getAllResources();
echo    
"<pre>";
print_r($resources);
echo    
"</pre>";

//    get one resource by its Id
$test $rddl->getResourceById('CSS');
echo    
"<pre>";
print_r($test);
echo    
"</pre>";

// get all stylesheets
$test $rddl->getResourcesByNature('http://www.w3.org/1999/XSL/Transform');
echo    
"<pre>";
print_r($test);
echo    
"</pre>";

// get all normative references
$test $rddl->getResourcesByPurpose('http://www.rddl.org/purposes#normative-reference');
echo    
"<pre>";
print_r($test);
echo    
"</pre>";
?>
Introduction to XML_RDDL (Previous) Constructor (Next)
Last updated: Thu, 18 Dec 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.