$myFile2 = base64_encode(trim($dc)); $agent->callModifyDatastreamByValue($val, $marcID, 'I', $marcLabel, $marc); $agent->callModifyDatastreamByValue($val, $dcID, 'A', $dcLabel, $dc); } $htmlFinal .= "<h1> Added </h1>Datafield '" . $datafieldtag . "'<h1>for Objects</h1>"; } else { if ($_POST['function_type'] == "Delete") { // print_r($GLOBALS); $deleteDataField = $_POST['dataFieldtag']; foreach ($fields as $key => $val) { $xml_MARC = get_Datastream($val, $marcID); $xml_output_dc = get_Datastream($val, $dcID); $handle = retrieveHandle($xml_output_dc, $dictionary['HandleNamespace']); $marcxml = deleteNode($xml_MARC, $deleteDataField); $agent = new Agent(); $dc_temp = $agent->transform2("./stylesheets/dc.xslt", $marcxml); //append identifiers information into DC i.e Handles (namespace:port and pid extracted from Val) and Pid = val $xmlDC = new simpleXMLElement($dc_temp); $namespace = $xmlDC->getNamespaces(true); $split = explode(":", $val); // $handle=$dictionary['HandleNamespace'].$split[1]; $xmlDC->addChild('dc:identifier', $val, $namespace['dc']); $xmlDC->addChild('dc:identifier', $handle, $namespace['dc']); $dc = $xmlDC->saveXML(); $marc = $marcxml->saveXML(); $myFile1 = base64_encode(trim($marc)); $myFile2 = base64_encode(trim($dc)); $agent->callModifyDatastreamByValue($val, $marcID, 'I', $marcLabel, $marc); $agent->callModifyDatastreamByValue($val, $dcID, 'A', $dcLabel, $dc); } $htmlFinal .= "<h1> Deleted all Occurances of </h1>Datafield '" . $deleteDataField . "' <h1> for Objects</h1>";