Example #1
0
 /**
  * Outputs description element child describing the repository's OAI
  * identifier implementation.
  *
  * @param DOMElement $parentElement Parent DOM element for XML output
  */
 public static function describeIdentifier($parentElement)
 {
     $elements = array('scheme' => 'oai', 'repositoryIdentifier' => self::$namespaceId, 'delimiter' => ':', 'sampleIdentifier' => self::itemtoOaiId(1));
     $oaiIdentifier = $parentElement->appendNewElementWithChildren('oai-identifier', $elements);
     //must set xmlns attribute manually to avoid DOM extension appending
     //default: prefix to element name
     $oaiIdentifier->setAttribute('xmlns', self::OAI_IDENTIFIER_NAMESPACE_URI);
     $oaiIdentifier->setAttribute('xsi:schemaLocation', self::OAI_IDENTIFIER_NAMESPACE_URI . ' ' . self::OAI_IDENTIFIER_SCHEMA_URI);
 }
Example #2
0
 /**
  * Appends the record's header to the XML response.
  *
  * Adds the identifier, datestamp and setSpec to a header element, and
  * appends in to the document.
  *
  * @param DOMElement $parentElement
  * @param Item $item
  */
 public function appendHeader($parentElement, $item)
 {
     $headerData['identifier'] = OaiPmhRepository_OaiIdentifier::itemToOaiId($item->id);
     $headerData['datestamp'] = OaiPmhRepository_Date::dbToUtc($item->modified);
     $collection = $item->getCollection();
     if ($collection && $collection->public) {
         $headerData['setSpec'] = $collection->id;
     }
     $parentElement->appendNewElementWithChildren('header', $headerData);
 }