Browse Source

added checks for missing dc datastream

pull/272/head
Jason MacWilliams 12 years ago
parent
commit
3ce9015df0
  1. 3
      includes/dublin_core.inc

3
includes/dublin_core.inc

@ -151,7 +151,8 @@ class DublinCore {
*/ */
public static function importFromXMLString($dc_xml) { public static function importFromXMLString($dc_xml) {
$dc_doc = new DomDocument(); $dc_doc = new DomDocument();
if ($dc_doc->loadXML($dc_xml)) { // a fix for the potential error of a missing DC (patching a possible fcrepo4 error)
if (!empty($dc_xml) && $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) {

Loading…
Cancel
Save