From bc2620b67eba0befeaf406e5d0de2ce5bd2ea1d0 Mon Sep 17 00:00:00 2001 From: preecej Date: Mon, 23 May 2011 22:08:16 +0000 Subject: [PATCH] svn path=/; revision=95 --- .../prototyping/NCBI_eDocSummary.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php diff --git a/preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php b/preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php new file mode 100644 index 0000000..7e38a66 --- /dev/null +++ b/preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php @@ -0,0 +1,49 @@ +"); // inst. new xml doc for output + +// build xml doc with NCBI data +$DocSum = $xml_out->addChild("DocSum"); +$DocSum->addChild("Id",$NCBI_doc->DocSum->Id); + +foreach ($NCBI_doc->xpath("//Item") as $item) { + switch((string) $item["Name"]) { // Get attributes as element indices + case "PubDate": + $DocSum->addChild("PubDate",$item); + break; + case "Author": + $authorList[] = $item; + break; + case "LastAuthor": + $DocSum->addChild("LastAuthor",$item); + break; + case "Title": + $DocSum->addChild("Title",$item); + break; + case "Volume": + $DocSum->addChild("Volume",$item); + break; + case "Pages": + $DocSum->addChild("Pages",$item); + break; + case "FullJournalName": + $DocSum->addChild("FullJournalName",$item); + break; + } +} + +$author_list = ""; +foreach ($authorList as $author) { + $author_list = $author_list . $author . ", "; +} +$DocSum->addChild("AuthorList",rtrim($author_list,", ")); + + +header('Content-Type: text/xml'); // output xml doctype in your response +echo $xml_out->asXML(); +?> + -- 2.34.1