Skip to content

Commit

Permalink
Fix the check for loaded MODS datastream.
Browse files Browse the repository at this point in the history
  • Loading branch information
JojoVes committed Jul 24, 2017
1 parent d34b9ee commit 13d2df7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions includes/utilities.inc
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ function islandora_newspaper_group_issues(array $issues) {
function islandora_newspaper_get_date_issued_from_mods(AbstractDatastream $datastream) {
$out = FALSE;
$dom = new DOMDocument();
$dom->loadXML($datastream->content);
$xpath = new DomXPath($dom);
if ($dom) {
if ($dom->loadXML($datastream->content)) {
$xpath = new DomXPath($dom);
$xpath->registerNamespace('ns', 'http://www.loc.gov/mods/v3');
// Assumes the canonical date issued exists in the first mods document under
// origin info and is not specified as a point, additional logic could be
Expand Down Expand Up @@ -310,9 +309,8 @@ EOQ;
function islandora_newspaper_set_mods_date_issued(AbstractDatastream $datastream, DateTime $date) {
$out = FALSE;
$dom = new DOMDocument();
$dom->loadXML($datastream->content);
$xpath = new DomXPath($dom);
if ($dom) {
if ($dom->loadXML($datastream->content)) {
$xpath = new DomXPath($dom);
$xpath->registerNamespace('ns', 'http://www.loc.gov/mods/v3');
// Assumes the canonical date issued exists in the first mods document under
// origin info and is not specified as a point, additional logic could be
Expand Down

0 comments on commit 13d2df7

Please sign in to comment.