Browse Source

ISLANDORA-227 Switched from SimpleXML to Dom because of namespace issues in SimpleXML.

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
cbba26b0f3
  1. 22
      ilives/book.inc

22
ilives/book.inc

@ -117,21 +117,13 @@ class IslandoraBook {
return; return;
} }
$mods_simple = simplexml_load_string($form_values['mods']['mods_record']); $mods_list_doc = new DomDocument();
$title = ''; $mods_list_doc->loadXML($form_values['mods']['mods_record']);
$mods_item_doc = new DomDocument();
$mods_simple->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); $mods_item = $mods_list_doc->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'mods')->item(0);
$mods_records = $mods_simple->xpath('//mods:mods'); $new_mods_item = $mods_item_doc->importNode($mods_item, TRUE);
$mods_record = $mods_records[0]; $mods_item_doc->appendChild($new_mods_item);
$titles = $mods_simple->xpath('//mods:title'); $mods_text = $mods_item_doc->saveXML();
$title = (string) $titles[0];
$mods_dom = dom_import_simplexml($mods_record);
$mods_dom->name = 'mods';
$mods_text = $mods_dom->ownerDocument->saveXML();
$mods_doc = new DOMDocument();
$new_node = $mods_doc->importNode($mods_dom, TRUE);
$mods_doc->documentElement->appendChild($new_node);
$mods_text = $mods_doc->saveXML();
global $user; global $user;
$mimetype = new MimeClass(); $mimetype = new MimeClass();

Loading…
Cancel
Save