示例#1
0
 /**
  * End element
  * @param bool $full_end
  */
 public function endElement($full_end = true)
 {
     if ($full_end) {
         parent::fullEndElement();
     } else {
         parent::endElement();
     }
 }
示例#2
0
文件: Dom.php 项目: fpoirotte/xrl
 public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
 {
     $xml = $this->value->asXML();
     // Not all combinations of PHP/libxml support stripping
     // the XML declaration. So, we do it ourselves here.
     if (strlen($xml) >= 6 && !strncmp($xml, '<?xml', 5) && strpos(" \t\r\n", $xml[5]) !== false) {
         $xml = (string) substr($xml, strpos($xml, '?>') + 2);
     }
     $writer->startElementNS('ex', 'dom', 'http://ws.apache.org/xmlrpc/namespaces/extensions');
     $writer->writeRaw($xml);
     $writer->fullEndElement();
 }
 public function export($v92ec19ffde05e15769b1bb3ee05ad745)
 {
     set_time_limit(0);
     if (!count($v92ec19ffde05e15769b1bb3ee05ad745)) {
         $v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
         $v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(0);
         $v92ec19ffde05e15769b1bb3ee05ad745 = $v8be74552df93e31bbdd6b36ed74bdb6a->result;
     }
     if (getRequest('as_file') === '0') {
         $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName());
         $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
         $result = $ved780287e302ec3b9fd3c5e78771919f->execute();
         return $result->saveXML();
     }
     $v857a5246dff0c3c79e476b004684f6d3 = "./sys-temp/export/";
     $vb80bb7740288fda1f201890375a60c8f = getRequest('param0');
     $v97fd815a3803a0588876bdd862014fed = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f . "." . parent::getFileExt();
     $v6990a54322d9232390a784c5c9247dd6 = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f;
     if (!is_dir($v6990a54322d9232390a784c5c9247dd6)) {
         mkdir($v6990a54322d9232390a784c5c9247dd6, 0777, true);
     }
     if (file_exists($v97fd815a3803a0588876bdd862014fed) && !file_exists(CURRENT_WORKING_DIR . '/sys-temp/runtime-cache/' . md5($this->getSourceName()))) {
         unlink($v97fd815a3803a0588876bdd862014fed);
     }
     if ($v92ec19ffde05e15769b1bb3ee05ad745) {
         $v33030abc929f083da5f6c3f755b46034 = array('./tpls/', './xsltTpls/', './css/', './js/', './usels/', './umaps/', './templates/');
         foreach ($v33030abc929f083da5f6c3f755b46034 as $v100664c6e2c0333b19a729f2f3ddb7dd) {
             if (is_dir($v100664c6e2c0333b19a729f2f3ddb7dd)) {
                 $v736007832d2167baaae763fd3a3f3cf1 = new umiDirectory($v100664c6e2c0333b19a729f2f3ddb7dd);
                 $v45b963397aa40d4a0063e0d85e4fe7a1 = $v736007832d2167baaae763fd3a3f3cf1->getAllFiles(1);
                 foreach ($v45b963397aa40d4a0063e0d85e4fe7a1 as $vd6fe1d0be6347b8ef2427fa629c04485 => $vb068931cc450442b63f5b3d276ea4297) {
                     $v8c7dd922ad47494fc02c388e12c00eac = new umiFile($vd6fe1d0be6347b8ef2427fa629c04485);
                     if (!is_dir($v6990a54322d9232390a784c5c9247dd6 . ltrim($v8c7dd922ad47494fc02c388e12c00eac->getDirName(), '.'))) {
                         mkdir($v6990a54322d9232390a784c5c9247dd6 . ltrim($v8c7dd922ad47494fc02c388e12c00eac->getDirName(), '.'), 0777, true);
                     }
                     copy($v8c7dd922ad47494fc02c388e12c00eac->getFilePath(), $v6990a54322d9232390a784c5c9247dd6 . $v8c7dd922ad47494fc02c388e12c00eac->getFilePath(true));
                 }
             }
         }
     }
     $v71b70dd1e455c477220693d84ccd5682 = $v97fd815a3803a0588876bdd862014fed . '.tmp';
     $v480d1b61a0432d1319f7504a3d7318dd = (int) mainConfiguration::getInstance()->get("modules", "exchange.export.limit");
     if ($v480d1b61a0432d1319f7504a3d7318dd <= 0) {
         $v480d1b61a0432d1319f7504a3d7318dd = 25;
     }
     $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName(), $v480d1b61a0432d1319f7504a3d7318dd);
     $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
     $vdd988cfd769c9f7fbd795a0f5da8e751 = $ved780287e302ec3b9fd3c5e78771919f->execute();
     if (file_exists($v97fd815a3803a0588876bdd862014fed)) {
         $v1de9b0a30075ae8c303eb420c103c320 = new XMLReader();
         $va82feee3cc1af8bcabda979e8775ef0f = new XMLWriter();
         $v1de9b0a30075ae8c303eb420c103c320->open($v97fd815a3803a0588876bdd862014fed);
         $va82feee3cc1af8bcabda979e8775ef0f->openURI($v71b70dd1e455c477220693d84ccd5682);
         $va82feee3cc1af8bcabda979e8775ef0f->startDocument('1.0', 'utf-8');
         $va82feee3cc1af8bcabda979e8775ef0f->startElement('umidump');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('version', '2.0');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('xmlns:xlink', 'http://www.w3.org/TR/xlink');
         $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         while ($v7aa28ed115707345d0274032757e8991) {
             if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                 $ve24455211a964330063a18670d943835 = $v1de9b0a30075ae8c303eb420c103c320->name;
                 if ($ve24455211a964330063a18670d943835 != 'umidump') {
                     $va82feee3cc1af8bcabda979e8775ef0f->startElement($ve24455211a964330063a18670d943835);
                     if ($ve24455211a964330063a18670d943835 != 'meta') {
                         if (!$v1de9b0a30075ae8c303eb420c103c320->isEmptyElement) {
                             $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->read();
                             while ($v7852ddca47412c0d947ebf27eb83ed3a) {
                                 if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                                     $vcf7f5c76225a101e6320a96c02f92fc1 = $v1de9b0a30075ae8c303eb420c103c320->name;
                                     $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readOuterXML());
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 } elseif ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::END_ELEMENT && $v1de9b0a30075ae8c303eb420c103c320->name == $ve24455211a964330063a18670d943835) {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = false;
                                 } else {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 }
                             }
                         }
                         if ($vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->hasChildNodes()) {
                             $v268184c12df027f536154d099d497b31 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->childNodes;
                             foreach ($v268184c12df027f536154d099d497b31 as $v1b7d5726533ab525a8760351e9b5e415) {
                                 $va5e171f642af8e3bd24c50cdc4d66fe3 = new DOMDocument();
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->formatOutput = true;
                                 $v36c4536996ca5615dcf9911f068786dc = $va5e171f642af8e3bd24c50cdc4d66fe3->importNode($v1b7d5726533ab525a8760351e9b5e415, true);
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->appendChild($v36c4536996ca5615dcf9911f068786dc);
                                 $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($va5e171f642af8e3bd24c50cdc4d66fe3->saveXML($v36c4536996ca5615dcf9911f068786dc, LIBXML_NOXMLDECL));
                             }
                         }
                     } elseif ($ve24455211a964330063a18670d943835 == 'meta') {
                         $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readInnerXML());
                         $v92ec19ffde05e15769b1bb3ee05ad745 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName('branches');
                         if ($v92ec19ffde05e15769b1bb3ee05ad745->item(0)) {
                             $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($vdd988cfd769c9f7fbd795a0f5da8e751->saveXML($v92ec19ffde05e15769b1bb3ee05ad745->item(0), LIBXML_NOXMLDECL));
                         }
                     }
                     $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
                     $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->next();
                     continue;
                 }
             }
             $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         }
         $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
         $v1de9b0a30075ae8c303eb420c103c320->close();
         $va82feee3cc1af8bcabda979e8775ef0f->endDocument();
         $va82feee3cc1af8bcabda979e8775ef0f->flush();
         unlink($v97fd815a3803a0588876bdd862014fed);
         rename($v71b70dd1e455c477220693d84ccd5682, $v97fd815a3803a0588876bdd862014fed);
     } else {
         file_put_contents($v97fd815a3803a0588876bdd862014fed, $vdd988cfd769c9f7fbd795a0f5da8e751->saveXML());
     }
     $this->completed = $ved780287e302ec3b9fd3c5e78771919f->isCompleted();
     return false;
 }
<?php

/* $Id$ */
$xw = new XMLWriter();
$xw->openMemory();
$xw->setIndent(TRUE);
$xw->setIndentString('   ');
$xw->startDocument('1.0', "UTF-8");
$xw->startElement('root');
$xw->startElementNS('ns1', 'child1', 'urn:ns1');
$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&');
$xw->writeElement('chars', "special characters: <>\"'&");
$xw->endElement();
$xw->startElement('empty');
$xw->fullEndElement();
$xw->fullEndElement();
// Force to write and empty the buffer
$output = $xw->flush(true);
print $output;
示例#5
0
foreach ($shop->offers as $offer) {
    /** @var $offer \corpsepk\yml\models\Offer */
    $writer->startElement('offer');
    foreach ($offer->offerElementAttributes as $attribute) {
        if (!empty($offer->{$attribute})) {
            $writer->writeAttribute($attribute, Html::encode($offer->{$attribute}));
        }
    }
    foreach ($offer->getOfferElements() as $attribute) {
        if (empty($offer->{$attribute})) {
            continue;
        }
        if (is_array($offer->{$attribute})) {
            foreach ($offer->{$attribute} as $value) {
                $writer->writeElement($attribute, Html::encode($value));
            }
        } else {
            $writer->writeElement($attribute, Html::encode($offer->{$attribute}));
        }
    }
    if (is_array($offer->param)) {
        foreach ($offer->param as $name => $value) {
            $writer->writeElement($name, Html::encode($value));
        }
    }
    $writer->endElement();
}
$writer->endElement();
$writer->fullEndElement();
$writer->fullEndElement();
$writer->endDocument();
 public function export($v92ec19ffde05e15769b1bb3ee05ad745)
 {
     set_time_limit(0);
     if (!count($v92ec19ffde05e15769b1bb3ee05ad745)) {
         $v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
         $v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(0);
         $v92ec19ffde05e15769b1bb3ee05ad745 = $v8be74552df93e31bbdd6b36ed74bdb6a->result;
     }
     $v857a5246dff0c3c79e476b004684f6d3 = CURRENT_WORKING_DIR . "/sys-temp/export/";
     $vb80bb7740288fda1f201890375a60c8f = getRequest('param0');
     $v97fd815a3803a0588876bdd862014fed = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f . "." . parent::getFileExt();
     if (getRequest('as_file') === '0') {
         $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName());
         $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
         $result = $ved780287e302ec3b9fd3c5e78771919f->execute();
         return $result->saveXML();
     }
     if (file_exists($v97fd815a3803a0588876bdd862014fed) && !file_exists(CURRENT_WORKING_DIR . '/sys-temp/runtime-cache/' . md5($this->getSourceName()))) {
         unlink($v97fd815a3803a0588876bdd862014fed);
     }
     $v71b70dd1e455c477220693d84ccd5682 = $v97fd815a3803a0588876bdd862014fed . '.tmp';
     $v480d1b61a0432d1319f7504a3d7318dd = (int) mainConfiguration::getInstance()->get("modules", "exchange.export.limit");
     if ($v480d1b61a0432d1319f7504a3d7318dd <= 0) {
         $v480d1b61a0432d1319f7504a3d7318dd = 25;
     }
     $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName(), $v480d1b61a0432d1319f7504a3d7318dd);
     $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
     $vdd988cfd769c9f7fbd795a0f5da8e751 = $ved780287e302ec3b9fd3c5e78771919f->execute();
     if (file_exists($v97fd815a3803a0588876bdd862014fed)) {
         $v1de9b0a30075ae8c303eb420c103c320 = new XMLReader();
         $va82feee3cc1af8bcabda979e8775ef0f = new XMLWriter();
         $v1de9b0a30075ae8c303eb420c103c320->open($v97fd815a3803a0588876bdd862014fed);
         $va82feee3cc1af8bcabda979e8775ef0f->openURI($v71b70dd1e455c477220693d84ccd5682);
         $va82feee3cc1af8bcabda979e8775ef0f->startDocument('1.0', 'utf-8');
         $va82feee3cc1af8bcabda979e8775ef0f->startElement('umidump');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('version', '2.0');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('xmlns:xlink', 'http://www.w3.org/TR/xlink');
         $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         while ($v7aa28ed115707345d0274032757e8991) {
             if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                 $ve24455211a964330063a18670d943835 = $v1de9b0a30075ae8c303eb420c103c320->name;
                 if ($ve24455211a964330063a18670d943835 != 'umidump') {
                     $va82feee3cc1af8bcabda979e8775ef0f->startElement($ve24455211a964330063a18670d943835);
                     if ($ve24455211a964330063a18670d943835 != 'meta') {
                         if (!$v1de9b0a30075ae8c303eb420c103c320->isEmptyElement) {
                             $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->read();
                             while ($v7852ddca47412c0d947ebf27eb83ed3a) {
                                 if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                                     $vcf7f5c76225a101e6320a96c02f92fc1 = $v1de9b0a30075ae8c303eb420c103c320->name;
                                     $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readOuterXML());
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 } elseif ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::END_ELEMENT && $v1de9b0a30075ae8c303eb420c103c320->name == $ve24455211a964330063a18670d943835) {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = false;
                                 } else {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 }
                             }
                         }
                         if ($vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->hasChildNodes()) {
                             $v268184c12df027f536154d099d497b31 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->childNodes;
                             foreach ($v268184c12df027f536154d099d497b31 as $v1b7d5726533ab525a8760351e9b5e415) {
                                 $va5e171f642af8e3bd24c50cdc4d66fe3 = new DOMDocument();
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->formatOutput = true;
                                 $v36c4536996ca5615dcf9911f068786dc = $va5e171f642af8e3bd24c50cdc4d66fe3->importNode($v1b7d5726533ab525a8760351e9b5e415, true);
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->appendChild($v36c4536996ca5615dcf9911f068786dc);
                                 $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($va5e171f642af8e3bd24c50cdc4d66fe3->saveXML($v36c4536996ca5615dcf9911f068786dc, LIBXML_NOXMLDECL));
                             }
                         }
                     } elseif ($ve24455211a964330063a18670d943835 == 'meta') {
                         $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readInnerXML());
                         $v92ec19ffde05e15769b1bb3ee05ad745 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName('branches');
                         if ($v92ec19ffde05e15769b1bb3ee05ad745->item(0)) {
                             $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($vdd988cfd769c9f7fbd795a0f5da8e751->saveXML($v92ec19ffde05e15769b1bb3ee05ad745->item(0), LIBXML_NOXMLDECL));
                         }
                     }
                     $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
                     $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->next();
                     continue;
                 }
             }
             $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         }
         $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
         $v1de9b0a30075ae8c303eb420c103c320->close();
         $va82feee3cc1af8bcabda979e8775ef0f->endDocument();
         $va82feee3cc1af8bcabda979e8775ef0f->flush();
         unlink($v97fd815a3803a0588876bdd862014fed);
         rename($v71b70dd1e455c477220693d84ccd5682, $v97fd815a3803a0588876bdd862014fed);
     } else {
         file_put_contents($v97fd815a3803a0588876bdd862014fed, $vdd988cfd769c9f7fbd795a0f5da8e751->saveXML());
     }
     $this->completed = $ved780287e302ec3b9fd3c5e78771919f->isCompleted();
     return false;
 }
示例#7
0
 /**
  * Record detail output in Dublin Core XML mode
  * @return  array
  *
  */
 public function DublinCoreOutput()
 {
     // get global configuration vars array
     global $sysconf;
     $protocol = isset($_SERVER["HTTPS"]) ? 'https' : 'http';
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     // set prefix and suffix
     $this->detail_prefix = '';
     $this->detail_suffix = '';
     $_xml_output = '';
     $_title_main = utf8_encode($this->record_detail['title']);
     /*
     // title
     $_title_main = utf8_encode($this->record_detail['title']);
     $_xml_output .= '<dc:title><![CDATA['.$_title_main.']]></dc:title>'."\n";
     
     // get the authors data
     $_biblio_authors_q = $this->obj_db->query('SELECT a.*,ba.level FROM mst_author AS a'
         .' LEFT JOIN biblio_author AS ba ON a.author_id=ba.author_id WHERE ba.biblio_id='.$this->detail_id);
     while ($_auth_d = $_biblio_authors_q->fetch_assoc()) {
         $_xml_output .= '<dc:creator><![CDATA['.utf8_encode($_auth_d['author_name']).']]></dc:creator>'."\n";
     }
     $_biblio_authors_q->free_result();
     
     // imprint/publication data
     $_xml_output .= '<dc:publisher><![CDATA['.utf8_encode($this->record_detail['publisher_name']).']]></dc:publisher>'."\n";
     
     if ($this->record_detail['publish_year']) {
       $_xml_output .= '<dc:date><![CDATA['.utf8_encode($this->record_detail['publish_year']).']]></dc:date>'."\n";
     } else {
       $_xml_output .= '<dc:date></dc:date>'."\n";  
     }
     
     // edition
     $_xml_output .= '<dc:hasVersion><![CDATA['.utf8_encode($this->record_detail['edition']).']]></dc:hasVersion>'."\n";
     
     // language
     $_xml_output .= '<dc:language><![CDATA['.utf8_encode($this->record_detail['language_name']).']]></dc:language>'."\n";
     
     // Physical Description/Collation
     $_xml_output .= '<dc:medium><![CDATA['.utf8_encode($this->record_detail['gmd_name']).']]></dc:medium>'."\n";
     $_xml_output .= '<dc:format><![CDATA['.utf8_encode($this->record_detail['gmd_name']).']]></dc:format>'."\n";
     if ((integer)$this->record_detail['frequency_id'] > 0) {
         $_xml_output .= '<dc:format><![CDATA[Serial]]></dc:format>'."\n";
     }
     $_xml_output .= '<dc:extent><![CDATA['.utf8_encode($this->record_detail['collation']).']]></dc:extent>'."\n";
     
     // Series title
     if ($this->record_detail['series_title']) {
       $_xml_output .= '<dc:isPartOf><![CDATA['.utf8_encode($this->record_detail['series_title']).']]></dc:isPartOf>'."\n";
     }
     
     // Note
     $_xml_output .= '<dc:description><![CDATA['.utf8_encode($this->record_detail['notes']).']]></dc:description>'."\n";
     $_xml_output .= '<dc:abstract><![CDATA['.utf8_encode($this->record_detail['notes']).']]></dc:abstract>'."\n";
     
     // subject/topic
     $_biblio_topics_q = $this->obj_db->query('SELECT t.topic, t.topic_type, t.auth_list, bt.level FROM mst_topic AS t
       LEFT JOIN biblio_topic AS bt ON t.topic_id=bt.topic_id WHERE bt.biblio_id='.$this->detail_id.' ORDER BY t.auth_list');
     while ($_topic_d = $_biblio_topics_q->fetch_assoc()) {
       $_xml_output .= '<dc:subject><![CDATA['.utf8_encode($_topic_d['topic']).']]></dc:subject>'."\n";
     }
     
     // classification
     $_xml_output .= '<dc:subject><![CDATA['.utf8_encode($this->record_detail['classification']).']]></dc:subject>';
     
     // Permalink
     $_xml_output .= '<dc:identifier><![CDATA['.$protocol.'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].SWB.'index.php?p=show_detail&id='.$this->detail_id.']]></dc:identifier>';
     
     // ISBN/ISSN
     $_xml_output .= '<dc:identifier><![CDATA['.str_replace(array('-', ' '), '', utf8_encode($this->record_detail['isbn_issn'])).']]></dc:identifier>';
     
     // Call Number
     $_xml_output .= '<dc:identifier><![CDATA['.utf8_encode($this->record_detail['call_number']).']]></dc:identifier>'."\n";
     
     $_copy_q = $this->obj_db->query('SELECT i.item_code, i.call_number, stat.item_status_name, loc.location_name, stat.rules, i.site FROM item AS i '
         .'LEFT JOIN mst_item_status AS stat ON i.item_status_id=stat.item_status_id '
         .'LEFT JOIN mst_location AS loc ON i.location_id=loc.location_id '
         .'WHERE i.biblio_id='.$this->detail_id);
     if ($_copy_q->num_rows > 0) {
         while ($_copy_d = $_copy_q->fetch_assoc()) {
             $_xml_output .= '<dc:hasPart><![CDATA['.utf8_encode($_copy_d['item_code']).']]></dc:hasPart>'."\n";
         }
     }
     
     // digital files
     $attachment_q = $this->obj_db->query('SELECT att.*, f.* FROM biblio_attachment AS att
         LEFT JOIN files AS f ON att.file_id=f.file_id WHERE att.biblio_id='.$this->detail_id.' AND att.access_type=\'public\' LIMIT 20');
     if ($attachment_q->num_rows > 0) {
       while ($attachment_d = $attachment_q->fetch_assoc()) {
           $dir = '';
           if ($attachment_d['file_dir']) {
             $dir = $attachment_d['file_dir'].'/';
           }
           $_xml_output .= '<dc:relation><![CDATA[';
           // check member type privileges
           if ($attachment_d['access_limit']) { continue; }
           $_xml_output .= $protocol.'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].REPO_WBS.$dir.trim(urlencode($attachment_d['file_name']));
           $_xml_output .= ']]></dc:relation>'."\n";
       }
     }
     
     // image
     if (!empty($this->record_detail['image'])) {
       $_image = urlencode($this->record_detail['image']);
     	  $_xml_output .= '<dc:relation><![CDATA['.$protocol.'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].SWB.'images/docs/'.urlencode($_image).']]></dc:relation>'."\n";
     }
     */
     // title
     $xml->startElementNS('dc', 'title', null);
     $xml->writeCdata($_title_main);
     $xml->endElement();
     // get the authors data
     $_biblio_authors_q = $this->obj_db->query('SELECT a.*,ba.level FROM mst_author AS a' . ' LEFT JOIN biblio_author AS ba ON a.author_id=ba.author_id WHERE ba.biblio_id=' . $this->detail_id);
     while ($_auth_d = $_biblio_authors_q->fetch_assoc()) {
         $xml->startElementNS('dc', 'creator', null);
         $xml->writeCdata($_auth_d['author_name']);
         $xml->endElement();
     }
     $_biblio_authors_q->free_result();
     // imprint/publication data
     $xml->startElementNS('dc', 'publisher', null);
     $xml->writeCdata($this->record_detail['publisher_name']);
     $xml->endElement();
     if ($this->record_detail['publish_year']) {
         $xml->startElementNS('dc', 'date', null);
         $xml->writeCdata($this->record_detail['publish_year']);
         $xml->endElement();
     } else {
         $xml->startElementNS('dc', 'date', null);
         $xml->fullEndElement();
     }
     // edition
     $xml->startElementNS('dc', 'hasVersion', null);
     $xml->writeCdata($this->record_detail['edition']);
     $xml->endElement();
     // language
     $xml->startElementNS('dc', 'language', null);
     $xml->writeCdata($this->record_detail['language_name']);
     $xml->endElement();
     // Physical Description/Collation
     $xml->startElementNS('dc', 'medium', null);
     $xml->writeCdata($this->record_detail['gmd_name']);
     $xml->endElement();
     $xml->startElementNS('dc', 'format', null);
     $xml->writeCdata($this->record_detail['gmd_name']);
     $xml->endElement();
     $xml->startElementNS('dc', 'extent', null);
     $xml->writeCdata($this->record_detail['collation']);
     $xml->endElement();
     if ((int) $this->record_detail['frequency_id'] > 0) {
         $xml->startElementNS('dc', 'format', null);
         $xml->writeCdata('serial');
         $xml->endElement();
     }
     // Series title
     if ($this->record_detail['series_title']) {
         $xml->startElementNS('dc', 'isPartOf', null);
         $xml->writeCdata($this->record_detail['series_title']);
         $xml->endElement();
     }
     // Note
     $xml->startElementNS('dc', 'description', null);
     $xml->writeCdata($this->record_detail['notes']);
     $xml->endElement();
     $xml->startElementNS('dc', 'abstract', null);
     $xml->writeCdata($this->record_detail['notes']);
     $xml->endElement();
     // subject/topic
     $_biblio_topics_q = $this->obj_db->query('SELECT t.topic, t.topic_type, t.auth_list, bt.level FROM mst_topic AS t
       LEFT JOIN biblio_topic AS bt ON t.topic_id=bt.topic_id WHERE bt.biblio_id=' . $this->detail_id . ' ORDER BY t.auth_list');
     while ($_topic_d = $_biblio_topics_q->fetch_assoc()) {
         $xml->startElementNS('dc', 'subject', null);
         $xml->writeCdata($_topic_d['topic']);
         $xml->endElement();
     }
     $_biblio_topics_q->free_result();
     // classification
     $xml->startElementNS('dc', 'subject', null);
     $xml->writeCdata($this->record_detail['classification']);
     $xml->endElement();
     // Permalink
     $permalink = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . SWB . 'index.php?p=show_detail&id=' . $this->detail_id;
     $xml->startElementNS('dc', 'identifier', null);
     $xml->writeCdata($permalink);
     $xml->endElement();
     // ISBN/ISSN
     $xml->startElementNS('dc', 'identifier', null);
     $xml->writeCdata(str_replace(array('-', ' '), '', $this->record_detail['isbn_issn']));
     $xml->endElement();
     // Call Number
     $xml->startElementNS('dc', 'identifier', null);
     $xml->writeCdata($this->record_detail['call_number']);
     $xml->endElement();
     $_copy_q = $this->obj_db->query('SELECT i.item_code, i.call_number, stat.item_status_name, loc.location_name, stat.rules, i.site FROM item AS i ' . 'LEFT JOIN mst_item_status AS stat ON i.item_status_id=stat.item_status_id ' . 'LEFT JOIN mst_location AS loc ON i.location_id=loc.location_id ' . 'WHERE i.biblio_id=' . $this->detail_id);
     if ($_copy_q->num_rows > 0) {
         while ($_copy_d = $_copy_q->fetch_assoc()) {
             $xml->startElementNS('dc', 'hasPart', null);
             $xml->writeCdata($_copy_d['item_code']);
             $xml->endElement();
         }
     }
     $_copy_q->free_result();
     // digital files
     $attachment_q = $this->obj_db->query('SELECT att.*, f.* FROM biblio_attachment AS att
         LEFT JOIN files AS f ON att.file_id=f.file_id WHERE att.biblio_id=' . $this->detail_id . ' AND att.access_type=\'public\' LIMIT 20');
     if ($attachment_q->num_rows > 0) {
         while ($attachment_d = $attachment_q->fetch_assoc()) {
             $dir = '';
             if ($attachment_d['file_dir']) {
                 $dir = $attachment_d['file_dir'] . '/';
             }
             $_xml_output .= '<dc:relation><![CDATA[';
             // check member type privileges
             if ($attachment_d['access_limit']) {
                 continue;
             }
             $xml->startElementNS('dc', 'relation', null);
             $xml->writeCdata($protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . REPO_WBS . $dir . trim(urlencode($attachment_d['file_name'])));
             $xml->endElement();
         }
     }
     // image
     if (!empty($this->record_detail['image'])) {
         $_image = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . IMGBS . 'docs/' . urlencode($this->record_detail['image']);
         $xml->startElementNS('dc', 'relation', null);
         $xml->writeCdata($_image);
         $xml->endElement();
     }
     return $xml->outputMemory();
 }