XML_RDDL::getResourcesByPurpose

XML_RDDL::getResourcesByPurpose() – selects all resources of a specified nature

Synopsis

require_once 'XML/RDDL.php';

array XML_RDDL::getResourcesByPurpose ( string $purpose )

Description

Gets all resources of a given purpose from an RDDL document. You have to call XML_RDDL::parseRDDL() first. The purpose of a resource is specified by the 'xlink:arcrole' attribute. The purpose of a resource link determines what the link will be used for. Frequently the purpose of a link can be determined from the nature of the referenced resource. For example the purpose of an XML Schema is typically schema validation, yet a schema may be comprised of a number of included modules and even when included modules are themselves an XML Schema, the purpose is as a module. You can find a list of well known purposes at http://www.rddl.org/purposes/.

Parameter

  • string $purpose - purpose of the resources you want to get.

Return value

array array containing all resources with the specified purpose.

Note

This function can not be called statically.

Usage example

Getting all normative references

<?php
require_once "XML/RDDL.php";
// create new 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 normative references
$ref $rddl->getResourcesByPurpose('http://www.rddl.org/purposes#normative-reference');
echo 
"<pre>";
print_r($ref);
echo 
"</pre>";
?>
selects all resources of a specified nature (Previous) selects all resources of a specified language (Next)
Last updated: Wed, 22 Oct 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.