/**
  * @copydoc Filter::process()
  * @param $input MetadataDescription
  */
 function &process(&$input)
 {
     // Start the XML document.
     $doc =& XMLCustomWriter::createDocument();
     // Create the root element.
     $root =& XMLCustomWriter::createElement($doc, 'xMetaDiss:xMetaDiss');
     // Add the XML namespace and schema.
     XMLCustomWriter::setAttribute($root, 'xmlns:xMetaDiss', 'http://www.d-nb.de/standards/xmetadissplus/');
     XMLCustomWriter::setAttribute($root, 'xmlns:cc', 'http://www.d-nb.de/standards/cc/');
     XMLCustomWriter::setAttribute($root, 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
     XMLCustomWriter::setAttribute($root, 'xmlns:dcmitype', 'http://purl.org/dc/dcmitype');
     XMLCustomWriter::setAttribute($root, 'xmlns:dcterms', 'http://purl.org/dc/terms/');
     XMLCustomWriter::setAttribute($root, 'xmlns:ddb', 'http://www.d-nb.de/standards/ddb/');
     XMLCustomWriter::setAttribute($root, 'xmlns:doi', 'http://www.d-nb.de/standards/doi/');
     XMLCustomWriter::setAttribute($root, 'xmlns:hdl', 'http://www.d-nb.de/standards/hdl/');
     XMLCustomWriter::setAttribute($root, 'xmlns:pc', 'http://www.d-nb.de/standards/pc/');
     XMLCustomWriter::setAttribute($root, 'xmlns', 'http://www.d-nb.de/standards/subject/');
     XMLCustomWriter::setAttribute($root, 'xmlns:thesis', 'http://www.ndltd.org/standards/metadata/etdms/1.0/');
     XMLCustomWriter::setAttribute($root, 'xmlns:urn', 'http://www.d-nb.de/standards/urn/');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.d-nb.de/standards/xmetadissplus/ http://www.d-nb.de/standards/xmetadissplus/xmetadissplus.xsd');
     // Prepare the XMDP document hierarchy from the XMDP MetadataDescription instance.
     $documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
     // Recursively join the document hierarchy into a single document.
     $root =& $this->_joinNodes($documentHierarchy);
     XMLCustomWriter::appendChild($doc, $root);
     // Retrieve the XML from the DOM.
     $output = XMLCustomWriter::getXml($doc);
     return $output;
 }
 /**
  * @copydoc Filter::process()
  * @param $input MetadataDescription
  */
 function &process(&$input)
 {
     // Start the XML document.
     $doc =& XMLCustomWriter::createDocument();
     // Create the root element.
     $root =& XMLCustomWriter::createElement($doc, 'mods');
     // Add the XML namespace and schema.
     XMLCustomWriter::setAttribute($root, 'version', '3.4');
     XMLCustomWriter::setAttribute($root, 'xmlns', 'http://www.loc.gov/mods/v3');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd');
     // Prepare the MODS document hierarchy from the MODS MetadataDescription instance.
     $documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
     // Recursively join the document hierarchy into a single document.
     $root =& $this->_joinNodes($documentHierarchy);
     XMLCustomWriter::appendChild($doc, $root);
     // Retrieve the XML from the DOM.
     $output = XMLCustomWriter::getXml($doc);
     return $output;
 }
 /**
  * @copydoc Filter::process()
  * @param $input MetadataDescription
  */
 function &process(&$input)
 {
     // Start the XML document.
     $doc =& XMLCustomWriter::createDocument();
     // Create the root element.
     $root =& XMLCustomWriter::createElement($doc, 'epicur');
     // Add the XML namespace and schema.
     XMLCustomWriter::setAttribute($root, 'xmlns:epicur', 'urn:nbn:de:1111-2004033116');
     XMLCustomWriter::setAttribute($root, 'xmlns', 'urn:nbn:de:1111-2004033116');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'urn:nbn:de:1111-2004033116 http://www.persistent-identifier.de/xepicur/version1.0/xepicur.xsd');
     // Prepare the XMDP document hierarchy from the XMDP MetadataDescription instance.
     $documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
     // Recursively join the document hierarchy into a single document.
     $root =& $this->_joinNodes($documentHierarchy);
     XMLCustomWriter::appendChild($doc, $root);
     // Retrieve the XML from the DOM.
     $output = XMLCustomWriter::getXml($doc);
     return $output;
 }
コード例 #4
0
ファイル: SolrWebService.inc.php プロジェクト: mosvits/ojs
 /**
  * Retrieve the XML for a batch of articles to be updated.
  *
  * @param $articles DBResultFactory The articles to be included
  *  in the list.
  * @param $totalCount integer The overall number of changed articles
  *  (not only the current batch).
  * @param $numDeleted integer An output parameter that returns
  *  the number of documents that will be deleted.
  *
  * @return string The XML ready to be consumed by the Solr data
  *  import service.
  */
 function _getArticleListXml(&$articles, $totalCount, &$numDeleted)
 {
     // Create the DOM document.
     $articleDoc =& XMLCustomWriter::createDocument();
     assert(is_a($articleDoc, 'DOMDocument'));
     // Create the root node.
     $articleList =& XMLCustomWriter::createElement($articleDoc, 'articleList');
     XMLCustomWriter::appendChild($articleDoc, $articleList);
     // Run through all articles in the batch and generate an
     // XML list for them.
     $numDeleted = 0;
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     /* @var $publishedArticleDao PublishedArticleDAO */
     foreach ($articles as $article) {
         if (!is_a($article, 'PublishedArticle')) {
             // Try to upgrade the article to a published article.
             $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($article->getId());
             if (is_a($publishedArticle, 'PublishedArticle')) {
                 unset($article);
                 $article =& $publishedArticle;
                 unset($publishedArticle);
             }
         }
         $journal = $this->_getJournal($article->getJournalId());
         // Check the publication state and subscription state of the article.
         if ($this->_isArticleAccessAuthorized($article)) {
             // Mark the article for update.
             $this->_addArticleXml($articleDoc, $article, $journal);
         } else {
             // Mark the article for deletion.
             $numDeleted++;
             $this->_addArticleXml($articleDoc, $article, $journal, true);
         }
         unset($journal, $article);
     }
     // Add the "has more" attribute so that the server knows
     // whether more batches may have to be pulled (useful for
     // pull indexing only).
     $hasMore = count($articles) < $totalCount ? 'yes' : 'no';
     $articleDoc->documentElement->setAttribute('hasMore', $hasMore);
     // Return XML.
     return XMLCustomWriter::getXml($articleDoc);
 }
コード例 #5
0
 function solrQuery(&$xmlDoc)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->getSetting('solrUrl') . '/update');
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type:text/xml; charset=utf-8"));
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, XMLCustomWriter::getXml($xmlDoc));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $data = curl_exec($ch);
     if (curl_errno($ch)) {
         curl_close($ch);
         fatalError('CURL Error: ' . curl_error($ch));
     } else {
         curl_close($ch);
         $xmlParser = new XMLParser();
         $result = null;
         @($result =& $xmlParser->parseTextStruct($data, array("int")));
         if ($result) {
             foreach ($result as $nodeSet) {
                 foreach ($nodeSet as $node) {
                     if (isset($node['attributes']['name']) && $node['attributes']['name'] == 'status' && $node['value'] == 0) {
                         return true;
                     }
                 }
             }
         }
         return false;
     }
 }