Пример #1
0
 *  Plain-format is not announced.
 */
$noparam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<formats>\n<format name=\"bibtex\" type=\"text/plain\" />\n<format name=\"csv\" type=\"text/plain\" />\n<format name=\"dc\" type=\"application/xml\" />\n<format name=\"extpp\" type=\"application/xml\" />\n<format name=\"json\" type=\"application/json\" />\n<format name=\"openurl-kev\" type=\"text/plain\" />\n<format name=\"rdf\" type=\"application/xml\" />\n<format name=\"text\" type=\"text/plain\" />\n<format name=\"xml\" type=\"application/xml\" />\n</formats>\n";
/*
 *  check if $id is not empty, if it's empty show
 *  available formats.
 */
if (!isset($id) || $id == '') {
    header('Content-type: application/xml');
    echo "{$noparam}";
    return;
}
//  instantiate new Picappn()
$pica = new Picappn();
//  set PPN as identifier
$pica->setPpn($id);
/*
 *  This is no part of the unAPI but for debugging.
 *  It is triggered by supplying "array" as $format and print_rs the
 *  pica-data as array.
 */
if ($format == "array") {
    echo "<head></head>\n<body>\n <pre>\n";
    print_r($pica->getArray());
    echo " </pre>\n</body>\n";
    die(0);
}
//  Final switch for printing result according to $format
switch ($format) {
    //  BibTeX
    case 'bibtex':