$v) $ret += (ord($v) % 128) * pow(64, $k); return "&#$ret;"; } function removeSpecialChars ($data) { global $specialcharsfrom, $specialcharsto; # echo "".$data.""; $cheese = str_replace($specialcharsfrom, $specialcharsto, $data); return $cheese; } //Initialize the XML parser $messenger = new XMLReader(); $messenger->open ($xmlfilename); $counter = 0; while ($messenger->read()) { switch ($messenger->name) { case "Root": $currentNumber = $messenger->getAttribute("Volume"); $dat = $messenger->getAttribute("Date"); $type = $messenger->nodeType; # 1: element, 15: end element! if ($type == 1) $msg_out .= "

Table of Contents Messenger No. ".$currentNumber." (".$dat.")

"; $browserTitle = "Messenger No. ".$currentNumber; break; case "Pdf": $messenger->read(); $currentPdf[$counter] = $messenger->value; $messenger->read(); break; case "Section": $messenger->read(); if ($currentSection != $messenger->value) { $currentSection = $messenger->value; $msg_out .= "

".$currentSection."

"; } $messenger->read(); break; case "Title": $messenger->read(); $title[$counter][] = $messenger->value; $messenger->read(); break; case "Authors": $messenger->read(); $temp = preg_replace ("/[0-9][,]?[0-9]?/",", ",$messenger->value); $authors[$counter][] = utf8_to_html($temp); $messenger->read(); break; case "Article": $page[$counter] = $messenger->getAttribute("Page"); $currentPdf[$counter] = $messenger->getAttribute("Pdf"); $thisSection = $messenger->getAttribute("Section"); /* optional */ if ($thisSection != $currentSection && $thisSection != "") { $currentSection = $thisSection; $msg_out .= "

".$currentSection."

"; } $type = $messenger->nodeType; if ($type == 15) { /* end of article, create output */ $msg_out .= "\n
".$page[$counter]; /* only for this edition !!! */ if (!$currentPdf[$counter]) $currentPdf[$counter] = $page[$counter]; if ($currentPdf[$counter] && $showpdflinks) { $msg_out .=" (PDF)"; } # Authors: has to work with several tags as well, so join them... $a_authors = array (); if ($authors[$counter]) { foreach ($authors[$counter] as $autoren) { # echo $autoren; $a_authors = array_merge ($a_authors, explode(", ", $autoren)); } } # clean empty items foreach ($a_authors as $i => $author) { if (empty($author)) unset($a_authors[$i]); } # $temp = preg_split("/[0-9][,]?[0-9]?[ |\n]/", $authors); # print_r ($a_authors); $number_of_authors = count($a_authors); # echo "
"; #.$number_of_authors."
"; if ($number_of_authors > 3) { $a_authors = array_slice($a_authors,0,2); $b_authors[$counter] = implode(", ",$a_authors)." et al."; } else { $b_authors[$counter] = implode(", ",$a_authors); } # print_r($a_authors); # echo $b_authors[$counter]." (".$counter.")
"; # no authors? if (!$b_authors[$counter]) $b_authors[$counter] = "ESO"; $msg_out .="
".$b_authors[$counter]."
".join(' ',$title[$counter])."
\n"; if ($abstract[$counter]) { $msg_out .= "
Abstract
"; $msg_out .= "
".$abstract[$counter]."
"; } # $msg_out .= "
Ende Artikel
"; $counter += 1; } break; case "Affiliations": $messenger->read(); # echo "".$messenger->value."
"; $messenger->read(); break; case "Abstract": $messenger->read(); $a_abstracts[] = "Abstract".$counter; $abstract[$counter] = $messenger->value; $messenger->read(); break; break; } } $messenger->close(); $openall_link = "
open all abstracts
"; $closeall_link = "
close all abstracts
"; $pdffile = 'PDF'; $headerparam = " "; include 'frame_top.php'; ?>
".$pdffile.' — '.$openall_link." — ".$closeall_link."
"; echo $msg_out; ?>