当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLCustomWriter::appendChild方法代码示例

本文整理汇总了PHP中XMLCustomWriter::appendChild方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLCustomWriter::appendChild方法的具体用法?PHP XMLCustomWriter::appendChild怎么用?PHP XMLCustomWriter::appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLCustomWriter的用法示例。


在下文中一共展示了XMLCustomWriter::appendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exportArticle

 function exportArticle(&$journal, &$issue, &$article, &$galley, $outputFile = null)
 {
     $this->import('EruditExportDom');
     $doc =& XMLCustomWriter::createDocument('article', '-//ERUDIT//Erudit Article DTD 3.0.0//EN', 'http://www.erudit.org/dtd/article/3.0.0/en/eruditarticle.dtd');
     $articleNode =& EruditExportDom::generateArticleDom($doc, $journal, $issue, $article, $galley);
     XMLCustomWriter::appendChild($doc, $articleNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"erudit.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:20,代码来源:EruditExportPlugin.inc.php

示例2: import

 function &getMetadataPage($pageNum, &$errors)
 {
     import('xml.XMLCustomWriter');
     import('db.DBResultRange');
     $journal =& Request::getJournal();
     $journalId = $journal->getJournalId();
     $falseVar = false;
     if ($pageNum < 1) {
         return $falseVar;
     }
     $rangeInfo =& new DBResultRange(GOOGLE_SCHOLAR_ITEMS_PER_PAGE, $pageNum);
     $document =& XMLCustomWriter::createDocument('articles', 'articles.dtd');
     $articlesNode =& XMLCustomWriter::createElement($document, 'articles');
     XMLCustomWriter::appendChild($document, $articlesNode);
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticles =& $publishedArticleDao->getPublishedArticlesByJournalId($journalId, $rangeInfo);
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issueCache = array();
     while ($publishedArticle =& $publishedArticles->next()) {
         $articleNode =& XMLCustomWriter::createElement($document, 'article');
         XMLCustomWriter::appendChild($articlesNode, $articleNode);
         $frontNode =& XMLCustomWriter::createElement($document, 'front');
         XMLCustomWriter::appendChild($articleNode, $frontNode);
         $journalMetaNode =& XMLCustomWriter::createElement($document, 'journal-meta');
         XMLCustomWriter::appendChild($frontNode, $journalMetaNode);
         // Journal Metadata
         $journal =& Request::getJournal();
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'journal-title', $journal->getJournalTitle(), true);
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'abbrev-journal-title', $journal->getLocalizedSetting('initials'), false);
         $issn = $journal->getSetting('onlineIssn');
         if (empty($issn)) {
             array_push($errors, Locale::translate('plugins.gateways.googleScholar.errors.noIssn'));
             return $falseVar;
         }
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'issn', $issn, false);
         $publisherNode =& XMLCustomWriter::createElement($document, 'publisher');
         $publisherName = $this->getSetting($journalId, 'publisher-name');
         if (empty($publisherName)) {
             array_push($errors, Locale::translate('plugins.gateways.googleScholar.errors.noPublisherName'));
             return $falseVar;
         }
         XMLCustomWriter::createChildWithText($document, $publisherNode, 'publisher-name', $publisherName, true);
         XMLCustomWriter::appendChild($journalMetaNode, $publisherNode);
         $articleMetaNode =& XMLCustomWriter::createElement($document, 'article-meta');
         XMLCustomWriter::appendChild($frontNode, $articleMetaNode);
         // Article Metadata
         $titleGroupNode =& XMLCustomWriter::createElement($document, 'title-group');
         XMLCustomWriter::appendChild($articleMetaNode, $titleGroupNode);
         $titles = $publishedArticle->getTitle(null);
         $primaryLocale = $journal->getPrimaryLocale();
         XMLCustomWriter::createChildWithText($document, $titleGroupNode, 'article-title', $titles[$primaryLocale], true);
         unset($titles[$primaryLocale]);
         foreach ($titles as $locale => $title) {
             XMLCustomWriter::createChildWithText($document, $titleGroupNode, 'trans-title', $title, false);
         }
         $contribGroupNode =& XMLCustomWriter::createElement($document, 'contrib-group');
         XMLCustomWriter::appendChild($articleMetaNode, $contribGroupNode);
         foreach ($publishedArticle->getAuthors() as $author) {
             $contribNode =& XMLCustomWriter::createElement($document, 'contrib');
             XMLCustomWriter::appendChild($contribGroupNode, $contribNode);
             XMLCustomWriter::setAttribute($contribNode, 'contrib-type', 'author');
             $nameNode =& XMLCustomWriter::createElement($document, 'name');
             XMLCustomWriter::appendChild($contribNode, $nameNode);
             // Opatan Inc.
             XMLCustomWriter::createChildWithText($document, $nameNode, 'surname', $author->getAuthorLastName(), true);
             // Given names in the form: FirstName MiddleName, where MiddleName is optional
             $name = $author->getAuthorFirstName();
             // Opatan Inc. : gets Localized author firstName
             if (($middleName = $author->getAuthorMiddleName()) != '') {
                 $name .= " {$middleName}";
             }
             // Opatan Inc.
             XMLCustomWriter::createChildWithText($document, $nameNode, 'given-names', $name, true);
         }
         $dateParts = getdate(strtotime($publishedArticle->getDatePublished()));
         $pubDateNode =& XMLCustomWriter::createElement($document, 'pub-date');
         XMLCustomWriter::appendChild($articleMetaNode, $pubDateNode);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'day', $dateParts['mday']);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'month', $dateParts['mon']);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'year', $dateParts['year']);
         $issueId = $publishedArticle->getIssueId();
         if (!isset($issueCache[$issueId])) {
             $issueCache[$issueId] =& $issueDao->getIssueById($issueId);
         }
         $issue =& $issueCache[$issueId];
         XMLCustomWriter::createChildWithText($document, $articleMetaNode, 'volume', $issue->getVolume());
         XMLCustomWriter::createChildWithText($document, $articleMetaNode, 'issue', $issue->getNumber());
         $canonicalUriNode =& XMLCustomWriter::createElement($document, 'self-uri');
         XMLCustomWriter::setAttribute($canonicalUriNode, 'xlink:href', Request::url(null, 'article', 'viewArticle', array($publishedArticle->getArticleId())));
         XMLCustomWriter::appendChild($articleMetaNode, $canonicalUriNode);
         foreach ($publishedArticle->getGalleys() as $galley) {
             $galleyUriNode =& XMLCustomWriter::createElement($document, 'self-uri');
             if ($galley->isHTMLGalley()) {
                 XMLCustomWriter::setAttribute($galleyUriNode, 'xlink:href', Request::url(null, 'article', 'viewArticle', array($publishedArticle->getArticleId(), $galley->getGalleyId())));
             } else {
                 XMLCustomWriter::setAttribute($galleyUriNode, 'xlink:href', Request::url(null, 'article', 'viewFile', array($publishedArticle->getArticleId(), $galley->getGalleyId())));
             }
             XMLCustomWriter::appendChild($articleMetaNode, $galleyUriNode);
         }
         unset($issue);
//.........这里部分代码省略.........
开发者ID:alenoosh,项目名称:ojs,代码行数:101,代码来源:GoogleScholarPlugin.inc.php

示例3:

 function &createChildWithText(&$doc, &$node, $name, $value, $appendIfEmpty = true)
 {
     $childNode = null;
     if ($appendIfEmpty || $value != '') {
         $childNode =& XMLCustomWriter::createElement($doc, $name);
         $textNode =& XMLCustomWriter::createTextNode($doc, $value);
         XMLCustomWriter::appendChild($childNode, $textNode);
         XMLCustomWriter::appendChild($node, $childNode);
     }
     return $childNode;
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:11,代码来源:XMLCustomWriter.inc.php

示例4: foreach

 /**
  * Create a description text element.
  *
  * @param $workOrProduct string
  * @param $relationCode string One of the O4DOI_RELATION_* constants.
  * @param $ids array
  *
  * @return XMLNode|DOMImplementation
  */
 function &_relationElement($workOrProduct, $relationCode, $ids)
 {
     $relationElement =& XMLCustomWriter::createElement($this->getDoc(), "Related{$workOrProduct}");
     // Relation code (mandatory)
     XMLCustomWriter::createChildWithText($this->getDoc(), $relationElement, 'RelationCode', $relationCode);
     // Work/Product ID (mandatory)
     foreach ($ids as $idType => $id) {
         XMLCustomWriter::appendChild($relationElement, $this->_idElement($workOrProduct, $idType, $id));
     }
     return $relationElement;
 }
开发者ID:reconciler,项目名称:ojs,代码行数:20,代码来源:O4DOIExportDom.inc.php

示例5: array

 /**
  * Create an XML element with a text node.
  *
  * FIXME: Move this to XMLCustomWriter? I leave the decision up to PKP...
  *
  * @param $name string
  * @param $value string
  * @param $attributes array An array with the attribute names as array
  *  keys and attribute values as array values.
  *
  * @return XMLNode|DOMImplementation
  */
 function &createElementWithText($name, $value, $attributes = array())
 {
     $element =& XMLCustomWriter::createElement($this->getDoc(), $name);
     $elementContent =& XMLCustomWriter::createTextNode($this->getDoc(), String::html2text($value));
     XMLCustomWriter::appendChild($element, $elementContent);
     foreach ($attributes as $attributeName => $attributeValue) {
         XMLCustomWriter::setAttribute($element, $attributeName, $attributeValue);
     }
     return $element;
 }
开发者ID:jalperin,项目名称:ojs,代码行数:22,代码来源:DOIExportDom.inc.php

示例6: exportArticles

 function exportArticles(&$results, $outputFile = null)
 {
     $this->import('NativeExportDom');
     $doc =& XMLCustomWriter::createDocument('articles', NATIVE_DTD_ID, NATIVE_DTD_URL);
     $articlesNode =& XMLCustomWriter::createElement($doc, 'articles');
     XMLCustomWriter::appendChild($doc, $articlesNode);
     foreach ($results as $result) {
         $article =& $result['publishedArticle'];
         $section =& $result['section'];
         $issue =& $result['issue'];
         $journal =& $result['journal'];
         $articleNode =& NativeExportDom::generateArticleDom($doc, $journal, $issue, $section, $article);
         XMLCustomWriter::appendChild($articlesNode, $articleNode);
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"articles.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:28,代码来源:NativeImportExportPlugin.inc.php

示例7: date

 /**
  *  Create METS:metsHdr for export
  */
 function &createmetsHdr($doc)
 {
     $root =& XMLCustomWriter::createElement($doc, 'METS:metsHdr');
     XMLCustomWriter::setAttribute($root, 'CREATEDATE', date('c'));
     XMLCustomWriter::setAttribute($root, 'LASTMODDATE', date('c'));
     $agentNode =& XMLCustomWriter::createElement($doc, 'METS:agent');
     XMLCustomWriter::setAttribute($agentNode, 'ROLE', 'DISSEMINATOR');
     XMLCustomWriter::setAttribute($agentNode, 'TYPE', 'ORGANIZATION');
     $organization = Request::getUserVar('organization');
     if ($organization == '') {
         $siteDao =& DAORegistry::getDAO('SiteDAO');
         $site = $siteDao->getSite();
         $organization = $site->getLocalizedTitle();
     }
     XMLCustomWriter::createChildWithText($doc, $agentNode, 'METS:name', $organization, false);
     XMLCustomWriter::appendChild($root, $agentNode);
     $agentNode2 =& XMLCustomWriter::createElement($doc, 'METS:agent');
     XMLCustomWriter::setAttribute($agentNode2, 'ROLE', 'CREATOR');
     XMLCustomWriter::setAttribute($agentNode2, 'TYPE', 'OTHER');
     XMLCustomWriter::createChildWithText($doc, $agentNode2, 'METS:name', MetsExportDom::getCreatorString(), false);
     XMLCustomWriter::appendChild($root, $agentNode2);
     return $root;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:26,代码来源:MetsExportDom.inc.php

示例8: elseif

 function &generateArticleDom(&$doc, &$journal, &$issue, &$section, &$article)
 {
     // register the editor submission DAO for use later
     $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
     /* --- Article --- */
     $root =& XMLCustomWriter::createElement($doc, 'Article');
     /* --- Journal --- */
     $journalNode =& XMLCustomWriter::createElement($doc, 'Journal');
     XMLCustomWriter::appendChild($root, $journalNode);
     $publisherInstitution = $journal->getSetting('publisherInstitution');
     $publisherNode = XMLCustomWriter::createChildWithText($doc, $journalNode, 'PublisherName', $publisherInstitution);
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'JournalTitle', $journal->getLocalizedTitle());
     // check various ISSN fields to create the ISSN tag
     if ($journal->getSetting('printIssn') != '') {
         $ISSN = $journal->getSetting('printIssn');
     } elseif ($journal->getSetting('issn') != '') {
         $ISSN = $journal->getSetting('issn');
     } elseif ($journal->getSetting('onlineIssn') != '') {
         $ISSN = $journal->getSetting('onlineIssn');
     } else {
         $ISSN = '';
     }
     if ($ISSN != '') {
         XMLCustomWriter::createChildWithText($doc, $journalNode, 'Issn', $ISSN);
     }
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'Volume', $issue->getVolume());
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'Issue', $issue->getNumber(), false);
     $datePublished = $article->getDatePublished();
     if (!$datePublished) {
         $datePublished = $issue->getDatePublished();
     }
     if ($datePublished) {
         $pubDateNode =& PubMedExportDom::generatePubDateDom($doc, $datePublished, 'epublish');
         XMLCustomWriter::appendChild($journalNode, $pubDateNode);
     }
     /* --- Replaces --- */
     // this creates a blank replaces tag since OJS doesn't contain PMID metadata
     //		XMLCustomWriter::createChildWithText($doc, $root, 'Replaces', '');
     /* --- ArticleTitle / VernacularTitle --- */
     // there is some ambiguity between whether to use
     // article->getlanguage or journal->getlocale
     // PubMed requires english titles for ArticleTitle
     $language = $article->getLanguage();
     if ($language == 'en' || $language == '') {
         XMLCustomWriter::createChildWithText($doc, $root, 'ArticleTitle', $article->getLocalizedTitle());
     } else {
         XMLCustomWriter::createChildWithText($doc, $root, 'VernacularTitle', $article->getLocalizedTitle());
     }
     /* --- FirstPage / LastPage --- */
     // there is some ambiguity for online journals as to what
     // "page numbers" are; for example, some journals (eg. JMIR)
     // use the "e-location ID" as the "page numbers" in PubMed
     $pages = $article->getPages();
     if (preg_match("/([0-9]+)\\s*-\\s*([0-9]+)/i", $pages, $matches)) {
         // simple pagination (eg. "pp. 3-8")
         XMLCustomWriter::createChildWithText($doc, $root, 'FirstPage', $matches[1]);
         XMLCustomWriter::createChildWithText($doc, $root, 'LastPage', $matches[2]);
     } elseif (preg_match("/(e[0-9]+)\\s*-\\s*(e[0-9]+)/i", $pages, $matches)) {
         // e9 - e14, treated as page ranges
         XMLCustomWriter::createChildWithText($doc, $root, 'FirstPage', $matches[1]);
         XMLCustomWriter::createChildWithText($doc, $root, 'LastPage', $matches[2]);
     } elseif (preg_match("/(e[0-9]+)/i", $pages, $matches)) {
         // single elocation-id (eg. "e12")
         XMLCustomWriter::createChildWithText($doc, $root, 'FirstPage', $matches[1]);
         XMLCustomWriter::createChildWithText($doc, $root, 'LastPage', $matches[1]);
     } else {
         // we need to insert something, so use the best ID possible
         XMLCustomWriter::createChildWithText($doc, $root, 'FirstPage', $article->getBestArticleId($journal));
         XMLCustomWriter::createChildWithText($doc, $root, 'LastPage', $article->getBestArticleId($journal));
     }
     /* --- DOI --- */
     if ($doi = $article->getPubId('doi')) {
         $doiNode =& XMLCustomWriter::createChildWithText($doc, $root, 'ELocationID', $doi, false);
         XMLCustomWriter::setAttribute($doiNode, 'EIdType', 'doi');
     }
     /* --- Language --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'Language', strtoupper($article->getLanguage()), false);
     /* --- AuthorList --- */
     $authorListNode =& XMLCustomWriter::createElement($doc, 'AuthorList');
     XMLCustomWriter::appendChild($root, $authorListNode);
     $authorIndex = 0;
     foreach ($article->getAuthors() as $author) {
         $authorNode =& PubMedExportDom::generateAuthorDom($doc, $author, $authorIndex++);
         XMLCustomWriter::appendChild($authorListNode, $authorNode);
     }
     /* --- ArticleIdList --- */
     // Pubmed will accept two types of article identifier: pii and doi
     // how this is handled is journal-specific, and will require either
     // configuration in the plugin, or an update to the core code.
     // this is also related to DOI-handling within OJS
     if ($article->getPubId('publisher-id')) {
         $articleIdListNode =& XMLCustomWriter::createElement($doc, 'ArticleIdList');
         XMLCustomWriter::appendChild($root, $articleIdListNode);
         $articleIdNode =& XMLCustomWriter::createChildWithText($doc, $articleIdListNode, 'ArticleId', $article->getPubId('publisher-id'));
         XMLCustomWriter::setAttribute($articleIdNode, 'IdType', 'pii');
     }
     /* --- History --- */
     $historyNode =& XMLCustomWriter::createElement($doc, 'History');
     XMLCustomWriter::appendChild($root, $historyNode);
     // date manuscript received for review
//.........这里部分代码省略.........
开发者ID:EreminDm,项目名称:water-cao,代码行数:101,代码来源:PubMedExportDom.inc.php

示例9: createSchedConfSitemap

 /**
  * Construct a sitemap for a scheduled conference
  * @return XMLNode
  */
 function createSchedConfSitemap()
 {
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
     $conference =& Request::getConference();
     $conferenceId = $conference->getId();
     $schedConf = Request::getSchedConf();
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'urlset');
     XMLCustomWriter::setAttribute($root, 'xmlns', SITEMAP_XSD_URL);
     // Sched. Conf. home
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath())));
     // About page
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'submissions')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'siteMap')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'aboutThisPublishingSystem')));
     // Search
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search', 'authors')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search', 'titles')));
     // Conference Information
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'overview')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'trackPolicies')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'presentations')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'accommodation')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'location')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'organizingTeam')));
     // Individual Papers
     $publishedPapers =& $publishedPaperDao->getPublishedPapers($schedConf->getId());
     while ($paper =& $publishedPapers->next()) {
         // Abstract
         XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', $paper->getId())));
         // Galley files
         $galleys = $galleyDao->getGalleysByPaper($paper->getId());
         foreach ($galleys as $galley) {
             XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', array($paper->getId(), $galley->getId()))));
         }
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:46,代码来源:SitemapHandler.inc.php

示例10: date

 function &generatePaperDom(&$doc, &$conference, &$track, &$paper)
 {
     // register the editor submission DAO for use later
     //		$editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
     /* --- MeetingAbstract --- */
     $root =& XMLCustomWriter::createElement($doc, 'MeetingAbstract');
     XMLCustomWriter::setAttribute($root, 'Status', 'Completed');
     /* --- DateCreated --- */
     $dateNode =& XMLCustomWriter::createElement($doc, 'DateCreated');
     XMLCustomWriter::appendChild($root, $dateNode);
     XMLCustomWriter::createChildWithText($doc, $dateNode, 'Year', date('Y'));
     XMLCustomWriter::createChildWithText($doc, $dateNode, 'Month', date('m'));
     XMLCustomWriter::createChildWithText($doc, $dateNode, 'Day', date('d'));
     /* --- Article/Paper --- */
     $articleNode =& XMLCustomWriter::createElement($doc, 'Article');
     XMLCustomWriter::setAttribute($articleNode, 'PubModel', 'Electronic');
     XMLCustomWriter::appendChild($root, $articleNode);
     /* --- Journal/Book --- */
     // FIXME: at the moment this is a null element required by NLM
     $journalNode =& XMLCustomWriter::createChildWithText($doc, $articleNode, 'Journal', null);
     $journalIssueNode =& XMLCustomWriter::createElement($doc, 'JournalIssue');
     XMLCustomWriter::setAttribute($journalIssueNode, 'CitedMedium', 'Internet');
     XMLCustomWriter::appendChild($journalNode, $journalIssueNode);
     $journalDateNode =& XMLCustomWriter::createElement($doc, 'PubDate');
     XMLCustomWriter::appendChild($journalIssueNode, $journalDateNode);
     XMLCustomWriter::createChildWithText($doc, $journalDateNode, 'MedlineDate', date('Y'));
     /* --- ArticleTitle --- */
     // NLM requires english titles for PaperTitle
     XMLCustomWriter::createChildWithText($doc, $articleNode, 'ArticleTitle', $paper->getLocalizedTitle());
     /* --- Pagination --- */
     // If there is no page number, then use abstract number
     $paginationNode =& XMLCustomWriter::createElement($doc, 'Pagination');
     XMLCustomWriter::appendChild($articleNode, $paginationNode);
     $pages = $paper->getPages();
     if (preg_match("/([0-9]+)\\s*-\\s*([0-9]+)/i", $pages, $matches)) {
         // simple pagination (eg. "pp. 3- 		8")
         XMLCustomWriter::createChildWithText($doc, $paginationNode, 'MedlinePgn', $matches[1] . '-' . $matches[2]);
     } elseif (preg_match("/(e[0-9]+)/i", $pages, $matches)) {
         // elocation-id (eg. "e12")
         XMLCustomWriter::createChildWithText($doc, $paginationNode, 'MedlinePgn', $matches[1]);
     } else {
         // we need to insert something, so use the best ID possible
         XMLCustomWriter::createChildWithText($doc, $paginationNode, 'MedlinePgn', $paper->getBestPaperId($conference));
     }
     /* --- Abstract --- */
     $abstractNode =& XMLCustomWriter::createElement($doc, 'Abstract');
     XMLCustomWriter::appendChild($articleNode, $abstractNode);
     XMLCustomWriter::createChildWithText($doc, $abstractNode, 'AbstractText', strip_tags($paper->getLocalizedAbstract()), false);
     /* --- Affiliation --- */
     $sponsor = $paper->getLocalizedSponsor();
     if ($sponsor != '') {
         XMLCustomWriter::createChildWithText($doc, $articleNode, 'Affiliation', $sponsor);
     }
     /* --- AuthorList --- */
     $authorListNode =& XMLCustomWriter::createElement($doc, 'AuthorList');
     XMLCustomWriter::setAttribute($authorListNode, 'CompleteYN', 'Y');
     XMLCustomWriter::appendChild($articleNode, $authorListNode);
     foreach ($paper->getAuthors() as $author) {
         $authorNode =& NLMExportDom::generateAuthorDom($doc, $author);
         XMLCustomWriter::appendChild($authorListNode, $authorNode);
     }
     /* --- Conference --- */
     $conferenceNode =& XMLCustomWriter::createElement($doc, 'Author');
     XMLCustomWriter::appendChild($authorListNode, $conferenceNode);
     XMLCustomWriter::createChildWithText($doc, $conferenceNode, 'CollectiveName', $conference->getConferenceTitle());
     // OtherInformation element goes here with location for current conference
     /* --- Language --- */
     XMLCustomWriter::createChildWithText($doc, $articleNode, 'Language', strtolower($paper->getLanguage()), false);
     /* --- MedlineJournalInfo--- */
     // FIXME: at the moment this is a null element required by NLM
     $journalInfoNode =& XMLCustomWriter::createChildWithText($doc, $root, 'MedlineJournalInfo', null);
     XMLCustomWriter::createChildWithText($doc, $journalInfoNode, 'MedlineTA', null);
     return $root;
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:74,代码来源:NLMExportDom.inc.php

示例11: exportPubIdsForIssues

 /**
  * Export public identifiers of one or more issues.
  * @param $journal object
  * @param $issues array
  * @param $outputFile xml file containing the exported public identifiers
  */
 function exportPubIdsForIssues($journal, $issues, $outputFile = null)
 {
     $doc =& XMLCustomWriter::createDocument('pubIds', PID_DTD_URL, PID_DTD_URL);
     $pubIdsNode =& XMLCustomWriter::createElement($doc, 'pubIds');
     XMLCustomWriter::appendChild($doc, $pubIdsNode);
     foreach ($issues as $issue) {
         $this->generatePubId($doc, $pubIdsNode, $issue, $journal->getId());
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         foreach ($publishedArticleDao->getPublishedArticles($issue->getId()) as $publishedArticle) {
             $this->generatePubId($doc, $pubIdsNode, $publishedArticle, $journal->getId());
             $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $galleys = $articleGalleyDao->getBySubmissionId($publishedArticle->getId());
             while ($galley = $galleys->next()) {
                 $this->generatePubId($doc, $pubIdsNode, $galley, $journal->getId());
             }
         }
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"pubIds.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
开发者ID:relaciones-internacionales-journal,项目名称:ojs,代码行数:37,代码来源:PubIdImportExportPlugin.inc.php

示例12: foreach

 /**
  * Generate the journal_article node (the heart of the file).
  * @param $doc XMLNode
  * @param $journal Journal
  * @param $issue Issue
  * @param $section Section
  * @param $article Article
  * @return XMLNode
  */
 function &generateJournalArticleDom(&$doc, &$journal, &$issue, &$section, &$article)
 {
     // Create the base node
     $journalArticleNode =& XMLCustomWriter::createElement($doc, 'journal_article');
     XMLCustomWriter::setAttribute($journalArticleNode, 'publication_type', 'full_text');
     /* Titles */
     $titlesNode =& XMLCustomWriter::createElement($doc, 'titles');
     XMLCustomWriter::createChildWithText($doc, $titlesNode, 'title', $article->getLocalizedTitle());
     XMLCustomWriter::appendChild($journalArticleNode, $titlesNode);
     $contributorsNode =& XMLCustomWriter::createElement($doc, 'contributors');
     /* AuthorList */
     $isFirst = true;
     foreach ($article->getAuthors() as $author) {
         $authorNode =& CrossRefExportDom::generateAuthorDom($doc, $author, $isFirst);
         $isFirst = false;
         XMLCustomWriter::appendChild($contributorsNode, $authorNode);
     }
     XMLCustomWriter::appendChild($journalArticleNode, $contributorsNode);
     /* publication date of issue */
     if ($issue->getDatePublished()) {
         $publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $issue->getDatePublished());
         XMLCustomWriter::appendChild($journalArticleNode, $publicationDateNode);
     }
     /* publisher_item is the article pages */
     if ($article->getPages() != '') {
         $publisherItemNode =& XMLCustomWriter::createElement($doc, 'publisher_item');
         XMLCustomWriter::createChildWithText($doc, $publisherItemNode, 'item_number', $article->getPages());
         XMLCustomWriter::appendChild($journalArticleNode, $publisherItemNode);
     }
     return $journalArticleNode;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:40,代码来源:CrossRefExportDom.inc.php

示例13: switch


//.........这里部分代码省略.........
             break;
         default:
             $suppFileType = 'other';
             break;
     }
     XMLCustomWriter::setAttribute($root, 'type', $suppFileType);
     XMLCustomWriter::setAttribute($root, 'public_id', $suppFile->getPubId('publisher-id'), false);
     XMLCustomWriter::setAttribute($root, 'language', $suppFile->getLanguage(), false);
     XMLCustomWriter::setAttribute($root, 'show_reviewers', $suppFile->getShowReviewers() ? 'true' : 'false');
     if (is_array($suppFile->getTitle(null))) {
         foreach ($suppFile->getTitle(null) as $locale => $title) {
             $titleNode =& XMLCustomWriter::createChildWithText($doc, $root, 'title', $title, false);
             if ($titleNode) {
                 XMLCustomWriter::setAttribute($titleNode, 'locale', $locale);
             }
             unset($titleNode);
         }
     }
     if (is_array($suppFile->getCreator(null))) {
         foreach ($suppFile->getCreator(null) as $locale => $creator) {
             $creatorNode =& XMLCustomWriter::createChildWithText($doc, $root, 'creator', $creator, false);
             if ($creatorNode) {
                 XMLCustomWriter::setAttribute($creatorNode, 'locale', $locale);
             }
             unset($creatorNode);
         }
     }
     if (is_array($suppFile->getSubject(null))) {
         foreach ($suppFile->getSubject(null) as $locale => $subject) {
             $subjectNode =& XMLCustomWriter::createChildWithText($doc, $root, 'subject', $subject, false);
             if ($subjectNode) {
                 XMLCustomWriter::setAttribute($subjectNode, 'locale', $locale);
             }
             unset($subjectNode);
         }
     }
     if ($suppFileType == 'other') {
         if (is_array($suppFile->getTypeOther(null))) {
             foreach ($suppFile->getTypeOther(null) as $locale => $typeOther) {
                 $typeOtherNode =& XMLCustomWriter::createChildWithText($doc, $root, 'type_other', $typeOther, false);
                 if ($typeOtherNode) {
                     XMLCustomWriter::setAttribute($typeOtherNode, 'locale', $locale);
                 }
                 unset($typeOtherNode);
             }
         }
     }
     if (is_array($suppFile->getDescription(null))) {
         foreach ($suppFile->getDescription(null) as $locale => $description) {
             $descriptionNode =& XMLCustomWriter::createChildWithText($doc, $root, 'description', $description, false);
             if ($descriptionNode) {
                 XMLCustomWriter::setAttribute($descriptionNode, 'locale', $locale);
             }
             unset($descriptionNode);
         }
     }
     if (is_array($suppFile->getPublisher(null))) {
         foreach ($suppFile->getPublisher(null) as $locale => $publisher) {
             $publisherNode =& XMLCustomWriter::createChildWithText($doc, $root, 'publisher', $publisher, false);
             if ($publisherNode) {
                 XMLCustomWriter::setAttribute($publisherNode, 'locale', $locale);
             }
             unset($publisherNode);
         }
     }
     if (is_array($suppFile->getSponsor(null))) {
         foreach ($suppFile->getSponsor(null) as $locale => $sponsor) {
             $sponsorNode =& XMLCustomWriter::createChildWithText($doc, $root, 'sponsor', $sponsor, false);
             if ($sponsorNode) {
                 XMLCustomWriter::setAttribute($sponsorNode, 'locale', $locale);
             }
             unset($sponsorNode);
         }
     }
     XMLCustomWriter::createChildWithText($doc, $root, 'date_created', NativeExportDom::formatDate($suppFile->getDateCreated()), false);
     if (is_array($suppFile->getSource(null))) {
         foreach ($suppFile->getSource(null) as $locale => $source) {
             $sourceNode =& XMLCustomWriter::createChildWithText($doc, $root, 'source', $source, false);
             if ($sourceNode) {
                 XMLCustomWriter::setAttribute($sourceNode, 'locale', $locale);
             }
             unset($sourceNode);
         }
     }
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($article->getId());
     $fileNode =& XMLCustomWriter::createElement($doc, 'file');
     XMLCustomWriter::appendChild($root, $fileNode);
     if ($suppFile->getRemoteURL()) {
         $remoteNode =& XMLCustomWriter::createElement($doc, 'remote');
         XMLCustomWriter::appendChild($fileNode, $remoteNode);
         XMLCustomWriter::setAttribute($remoteNode, 'src', $suppFile->getRemoteURL());
     } else {
         $embedNode =& XMLCustomWriter::createChildWithText($doc, $fileNode, 'embed', base64_encode($articleFileManager->readFile($suppFile->getFileId())));
         XMLCustomWriter::setAttribute($embedNode, 'filename', $suppFile->getOriginalFileName());
         XMLCustomWriter::setAttribute($embedNode, 'encoding', 'base64');
         XMLCustomWriter::setAttribute($embedNode, 'mime_type', $suppFile->getFileType());
     }
     return $root;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:101,代码来源:NativeExportDom.inc.php

示例14: callbackFinish

 /**
  * Index rebuild cleanup: mark select options as clean.
  */
 function callbackFinish($hookName, $args)
 {
     $searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
     $searchFormElements =& $searchFormElementDao->getSearchFormElements();
     while ($searchFormElement =& $searchFormElements->next()) {
         $searchFormElement->setIsClean(true);
         $searchFormElementDao->updateSearchFormElement($searchFormElement);
         unset($searchFormElement);
     }
     if ($this->isUsingSolr()) {
         import('lib.pkp.classes.xml.XMLCustomWriter');
         $doc =& XMLCustomWriter::createDocument('commit', SOLR_DTD_ID, SOLR_DTD_URL);
         $docNode =& XMLCustomWriter::createElement($doc, 'commit');
         XMLCustomWriter::appendChild($doc, $docNode);
         $this->solrQuery($doc);
         unset($doc);
         $doc =& XMLCustomWriter::createDocument('optimize', SOLR_DTD_ID, SOLR_DTD_URL);
         $docNode =& XMLCustomWriter::createElement($doc, 'optimize');
         XMLCustomWriter::appendChild($doc, $docNode);
         $this->solrQuery($doc);
         unset($doc);
     } else {
         $index =& $this->getIndex();
         $index->optimize();
     }
 }
开发者ID:ramonsodoma,项目名称:harvester,代码行数:29,代码来源:ZendSearchPlugin.inc.php

示例15: exportPapers

 function exportPapers(&$results, $outputFile = null)
 {
     $this->import('NLMExportDom');
     $doc =& NLMExportDom::generateNLMDom();
     $paperSetNode =& NLMExportDom::generatePaperSetDom($doc);
     foreach ($results as $result) {
         $conference =& $result['conference'];
         $track =& $result['track'];
         $paper =& $result['publishedPaper'];
         $paperNode =& NLMExportDom::generatePaperDom($doc, $conference, $track, $paper);
         XMLCustomWriter::appendChild($paperSetNode, $paperNode);
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"nlm.xml\"");
         XMLCustomWriter::printXML($doc);
         //echo '<pre>'.htmlentities(preg_replace('/></', ">\n<", XMLCustomWriter::getXML($doc))).'</pre>';
     }
     return true;
 }
开发者ID:jalperin,项目名称:ocs,代码行数:27,代码来源:NLMExportPlugin.inc.php


注:本文中的XMLCustomWriter::appendChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。