getPaperTitle()); /* --- 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->getPaperAbstract()), false); /* --- Affiliation --- */ $sponsor = $paper->getPaperSponsor(); 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->getPresenters() 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; } function &generateAuthorDom(&$doc, &$author) { $root = &XMLCustomWriter::createElement($doc, 'Author'); $foreName = trim($author->getFirstName() .' '.$author->getMiddleName()); XMLCustomWriter::createChildWithText($doc, $root, 'LastName', ucfirst($author->getLastName())); XMLCustomWriter::createChildWithText($doc, $root, 'ForeName', ucwords($foreName)); return $root; } } ?>