private function toXml($array, $xml = false) { $simxml = new simpleXMLElement('<!--?xml version="1.0" encoding="utf-8"?--><root></root>'); foreach ($array as $k => $v) { $simxml->addChild($k, $v); } return $simxml->saveXML(); }
$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>"; } else { $htmlFinal .= "Please select a functionality before proceeding !"; } } } } else { $htmlFinal .= "nothing Submitted"; }