Skip to content
Snippets Groups Projects
Commit 3ac2935e authored by André Lahmann's avatar André Lahmann Committed by Robert Lange
Browse files

refs #21701 [finc] added parseDOI to finc Redi driver to reflect changed...

refs #21701 [finc] added parseDOI to finc Redi driver to reflect changed return array from https://github.com/vufind-org/vufind/pull/2419
parent cf9f6151
No related merge requests found
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
namespace finc\Resolver\Driver; namespace finc\Resolver\Driver;
use VuFind\Resolver\Driver\Redi as RediBase; use VuFind\Resolver\Driver\Redi as RediBase;
use Zend\Dom\DOMXPath;
/** /**
* Redi Link Resolver Driver * Redi Link Resolver Driver
...@@ -57,4 +58,42 @@ class Redi extends RediBase ...@@ -57,4 +58,42 @@ class Redi extends RediBase
$feed = $this->httpClient->setUri($url)->send()->getBody(); $feed = $this->httpClient->setUri($url)->send()->getBody();
return $feed; return $feed;
} }
/**
* Parse the Redi XML response and return array with DOI information.
*
* @param DOMDocument $xml Loaded xml document
*
* @deprecated with VuFind 9 - cf. https://github.com/vufind-org/vufind/pull/2419
* @return array Get back a array with title, URL and service_type
*/
protected function parseDOI($xml)
{
$retval = [];
$xpath = new DOMXPath($xml);
$doiTerm = $xpath
->query("//dt[@class='doi_t']");
$doiDefinition = $xpath
->query("//dd[@class='doi_d']");
if ($doiTerm->length == $doiDefinition->length) {
for ($i = 0; $i < $doiTerm->length; $i++) {
$href = $xpath
->query(".//@href", $doiDefinition->item($i))
->item(0)->textContent;
$retval[] = [
'title' => $doiTerm->item($i)->textContent
. $doiDefinition->item($i)->textContent,
'href' => $href,
'access' => 'unknown',
'coverage' => null,
'service_type' => 'getDOI',
];
}
}
return $retval;
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment