コード例 #1
0
ファイル: OAIParser.php プロジェクト: arkuuu/publin
 /**
  * @param Publication $publication
  *
  * @return DOMElement
  */
 private function createRecordHeader(Publication $publication)
 {
     $xml = new DOMDocument('1.0', 'UTF-8');
     $header = $xml->createElement('header');
     $header->appendChild($xml->createElement('identifier', 'oai:' . $this->repositoryIdentifier . ':' . $publication->getId()));
     $header->appendChild($xml->createElement('datestamp', $publication->getDateAdded('Y-m-d')));
     $keywords = $publication->getKeywords();
     foreach ($keywords as $keyword) {
         $setSpec = str_replace(' ', '_', $keyword->getName());
         $setSpec = strtolower($setSpec);
         $header->appendChild($xml->createElement('setSpec', $setSpec));
     }
     return $header;
 }