/** * Return an XML representation of the record using the specified format. * Return false if the format is unsupported. * * @param string $format Name of format to use (corresponds with OAI-PMH * metadataPrefix parameter). * * @return mixed XML, or false if format unsupported. * @access public */ public function getXML($format) { // Special case for MARC: if ($format == 'marc21') { $xml = $this->marcRecord->toXML(); $xml = str_replace(array(chr(27), chr(28), chr(29), chr(30), chr(31)), ' ', $xml); $xml = simplexml_load_string($xml); if (!$xml || !isset($xml->record)) { return false; } // Set up proper namespacing and extract just the <record> tag: $xml->record->addAttribute('xmlns', "http://www.loc.gov/MARC21/slim"); $xml->record->addAttribute('xsi:schemaLocation', 'http://www.loc.gov/MARC21/slim ' . 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd', 'http://www.w3.org/2001/XMLSchema-instance'); $xml->record->addAttribute('type', 'Bibliographic'); return $xml->record->asXML(); } // Try the parent method: return parent::getXML($format); }