Browse Source

Merge pull request #224 from nhart/7.x

catch bad dc.. or qdc elements
pull/225/merge
Jonathan Green 12 years ago
parent
commit
ed0a7e6f3a
  1. 5
      includes/DublinCore.inc

5
includes/DublinCore.inc

@ -39,7 +39,7 @@ class DublinCore {
* @param string $dc_xml * @param string $dc_xml
*/ */
function DublinCore($dc_xml = NULL) { function DublinCore($dc_xml = NULL) {
if (!empty($dc_string)) { if (!empty($dc_xml)) {
$this->dc = self::import_from_xml_string($dc_xml); $this->dc = self::import_from_xml_string($dc_xml);
} }
} }
@ -145,9 +145,12 @@ class DublinCore {
if ($dc_doc->loadXML($dc_xml)) { if ($dc_doc->loadXML($dc_xml)) {
$oai_dc = $dc_doc->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', '*'); $oai_dc = $dc_doc->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', '*');
$new_dc = new DublinCore(); $new_dc = new DublinCore();
foreach ($oai_dc as $child) { foreach ($oai_dc as $child) {
if(isset($new_dc->dc[$child->nodeName])) {
array_push($new_dc->dc[$child->nodeName], $child->nodeValue); array_push($new_dc->dc[$child->nodeName], $child->nodeValue);
} }
}
return $new_dc; return $new_dc;
} }
else { else {

Loading…
Cancel
Save