当前位置: 首页>>代码示例>>PHP>>正文


PHP XML::addXMLasBranch方法代码示例

本文整理汇总了PHP中XML::addXMLasBranch方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::addXMLasBranch方法的具体用法?PHP XML::addXMLasBranch怎么用?PHP XML::addXMLasBranch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XML的用法示例。


在下文中一共展示了XML::addXMLasBranch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: oaidcCollection

function oaidcCollection($result)
{
    global $contentTypeCharset;
    // these variables are defined in 'ini.inc.php'
    global $convertExportDataToUTF8;
    global $citeKeysArray;
    // '$citeKeysArray' is made globally available from
    // within this function
    // Individual records are objects and collections of records are strings
    $oaidcCollectionDoc = new XMLDocument();
    if ($convertExportDataToUTF8 == "yes" and $contentTypeCharset != "UTF-8") {
        $oaidcCollectionDoc->setEncoding("UTF-8");
    } else {
        $oaidcCollectionDoc->setEncoding($contentTypeCharset);
    }
    $oaidcCollection = new XML("dcCollection");
    $oaidcCollection->setTagAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/");
    $oaidcCollection->setTagAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
    $oaidcCollection->setTagAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    $oaidcCollection->setTagAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd");
    // ----------------------------------------------------------
    // Add OAI_DC XML entries:
    $exportArray = array();
    // array for individually exported records
    $citeKeysArray = array();
    // array of cite keys (used to ensure uniqueness of cite keys among all exported records)
    // Generate the export for each record and push them onto an array:
    while ($row = @mysql_fetch_array($result)) {
        // Export the current record as OAI_DC XML:
        $record = oaidcRecord($row, "oai_dc");
        if (!empty($record)) {
            // unless the record buffer is empty...
            array_push($exportArray, $record);
        }
        // ...add it to an array of exports
    }
    // for each of the OAI_DC XML entries in the result set...
    foreach ($exportArray as $oaidc) {
        $oaidcCollection->addXMLasBranch($oaidc);
    }
    $oaidcCollectionDoc->setXML($oaidcCollection);
    $oaidcCollectionString = $oaidcCollectionDoc->getXMLString();
    return $oaidcCollectionString;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:44,代码来源:oaidcxml.inc.php

示例2: modsCollection

function modsCollection($result)
{
    global $contentTypeCharset;
    // these variables are defined in 'ini.inc.php'
    global $convertExportDataToUTF8;
    global $citeKeysArray;
    // '$citeKeysArray' is made globally available from
    // within this function
    // The array '$transtab_refbase_unicode' contains search & replace patterns
    // for conversion from refbase markup to Unicode entities.
    global $transtab_refbase_unicode;
    // defined in 'transtab_refbase_unicode.inc.php'
    global $fieldSpecificSearchReplaceActionsArray;
    // Individual records are objects and collections of records are strings
    $exportArray = array();
    // array for individually exported records
    $citeKeysArray = array();
    // array of cite keys (used to ensure uniqueness of
    // cite keys among all exported records)
    // Defines field-specific search & replace 'actions' that will be applied to all
    // those refbase fields that are listed in the corresponding 'fields' element:
    // (If you don't want to perform any search and replace actions, specify an empty
    //  array, like: '$fieldSpecificSearchReplaceActionsArray = array();'.
    //  Note that the search patterns MUST include the leading & trailing slashes --
    //  which is done to allow for mode modifiers such as 'imsxU'.)
    $fieldSpecificSearchReplaceActionsArray = array();
    if ($convertExportDataToUTF8 == "yes") {
        $fieldSpecificSearchReplaceActionsArray[] = array('fields' => array("title", "publication", "abbrev_journal", "address", "keywords", "abstract", "orig_title", "series_title", "abbrev_series_title", "notes"), 'actions' => $transtab_refbase_unicode);
    }
    // Generate the export for each record and push them onto an array:
    while ($row = @mysql_fetch_array($result)) {
        // Export the current record as MODS XML
        $record = modsRecord($row);
        if (!empty($record)) {
            // unless the record buffer is empty...
            array_push($exportArray, $record);
        }
        // ...add it to an array of exports
    }
    $modsCollectionDoc = new XMLDocument();
    if ($convertExportDataToUTF8 == "yes" and $contentTypeCharset != "UTF-8") {
        $modsCollectionDoc->setEncoding("UTF-8");
    } else {
        $modsCollectionDoc->setEncoding($contentTypeCharset);
    }
    $modsCollection = new XML("modsCollection");
    $modsCollection->setTagAttribute("xmlns", "http://www.loc.gov/mods/v3");
    foreach ($exportArray as $mods) {
        $modsCollection->addXMLasBranch($mods);
    }
    $modsCollectionDoc->setXML($modsCollection);
    $modsCollectionString = $modsCollectionDoc->getXMLString();
    return $modsCollectionString;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:54,代码来源:modsxml.inc.php


注:本文中的XML::addXMLasBranch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。