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


PHP XML::setTagAttribute方法代码示例

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


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

示例1: unapiExplainResponse

function unapiExplainResponse($unapiID)
{
    global $contentTypeCharset;
    // these variables are specified in 'ini.inc.php'
    $unapiCollectionDoc = new XMLDocument();
    $unapiCollectionDoc->setEncoding($contentTypeCharset);
    $unapiCollection = new XML("formats");
    if (!empty($unapiID)) {
        $unapiCollection->setTagAttribute("id", $unapiID);
    }
    // Recommended format names are given at <http://unapi.stikipad.com/unapi/show/existing+formats>
    // TODO: add 'ISI', 'ODF XML' and 'Word XML'
    addNewBranch($unapiCollection, "format", array("name" => "bibtex", "type" => "text/plain", "docs" => "http://en.wikipedia.org/wiki/BibTeX"), "");
    // function 'addNewBranch()' is defined in 'webservice.inc.php'
    addNewBranch($unapiCollection, "format", array("name" => "endnote", "type" => "text/plain", "docs" => "http://www.ecst.csuchico.edu/~jacobsd/bib/formats/endnote.html"), "");
    addNewBranch($unapiCollection, "format", array("name" => "ris", "type" => "text/plain", "docs" => "http://www.adeptscience.co.uk/kb/article/A626"), "");
    addNewBranch($unapiCollection, "format", array("name" => "atom", "type" => "application/atom+xml", "docs" => "http://www.atomenabled.org/developers/syndication/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "mods", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/mods/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "oai_dc", "type" => "application/xml", "docs" => "http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore"), "");
    addNewBranch($unapiCollection, "format", array("name" => "srw_dc", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/sru/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "srw_mods", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/sru/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "html", "type" => "text/html", "docs" => "http://www.w3.org/MarkUp/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "rtf", "type" => "application/rtf", "docs" => "http://en.wikipedia.org/wiki/Rich_Text_Format"), "");
    addNewBranch($unapiCollection, "format", array("name" => "pdf", "type" => "application/pdf", "docs" => "http://partners.adobe.com/public/developer/pdf/index_reference.html"), "");
    addNewBranch($unapiCollection, "format", array("name" => "latex", "type" => "application/x-latex", "docs" => "http://en.wikipedia.org/wiki/LaTeX"), "");
    addNewBranch($unapiCollection, "format", array("name" => "markdown", "type" => "text/plain", "docs" => "http://daringfireball.net/projects/markdown/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "text", "type" => "text/plain"), "");
    $unapiCollectionDoc->setXML($unapiCollection);
    $unapiCollectionString = $unapiCollectionDoc->getXMLString();
    return $unapiCollectionString;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:31,代码来源:unapi.inc.php

示例2: srwGenerateBaseTags

function srwGenerateBaseTags($srwOperation)
{
    global $exportFormat;
    // this is needed so that we can distinguish between "SRW_DC XML" and "SRW_MODS XML" record formats
    $srwCollection = new XML("srw:" . $srwOperation);
    $srwCollection->setTagAttribute("xmlns:srw", "http://www.loc.gov/zing/srw/");
    if ($srwOperation == "searchRetrieveResponse") {
        $srwCollection->setTagAttribute("xmlns:diag", "http://www.loc.gov/zing/srw/diagnostic/");
        $srwCollection->setTagAttribute("xmlns:xcql", "http://www.loc.gov/zing/cql/xcql/");
        if (preg_match("/DC/i", $exportFormat)) {
            $srwCollection->setTagAttribute("xmlns:srw_dc", "info:srw/schema/1/dc-v1.1");
            $srwCollection->setTagAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
            $srwCollection->setTagAttribute("xmlns:prism", "http://prismstandard.org/namespaces/1.2/basic/");
        } else {
            // add namespace declarations for "SRW_MODS XML":
            $srwCollection->setTagAttribute("xmlns:mods", "http://www.loc.gov/mods/v3");
        }
    }
    //	elseif ($srwOperation == "explainResponse")
    //	{
    //		$srwCollection->setTagAttribute("xmlns:zr", "http://explain.z3950.org/dtd/2.0/");
    //	}
    addNewBranch($srwCollection, "srw:version", array(), "1.1");
    // function 'addNewBranch()' is defined in 'webservice.inc.php'
    return $srwCollection;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:26,代码来源:srwxml.inc.php

示例3: modsRecord

function modsRecord($row)
{
    global $databaseBaseURL;
    // these variables are defined in 'ini.inc.php'
    global $contentTypeCharset;
    global $fileVisibility;
    global $fileVisibilityException;
    global $filesBaseURL;
    global $convertExportDataToUTF8;
    // defined in 'transtab_unicode_charset.inc.php' and 'transtab_latin1_charset.inc.php'
    global $alnum, $alpha, $cntrl, $dash, $digit, $graph, $lower, $print, $punct, $space, $upper, $word, $patternModifiers;
    $exportPrivate = True;
    // This will be a global variable or will be used
    // when modsRow is called and will determine if we
    // export user-specific data
    $exportRecordURL = True;
    // Specifies whether an attribution string containing
    // the URL to the refbase database record (and the last
    // modification date) shall be written to the notes branch.
    // Note that this string is required by the "-A|--append"
    // feature of the 'refbase' command line client
    // convert this record's modified date/time info to UNIX time stamp format:
    // => "date('D, j M Y H:i:s O')", e.g. "Sat, 15 Jul 2006 22:24:16 +0200"
    // function 'generateRFC2822TimeStamp()' is defined in 'include.inc.php'
    $currentDateTimeStamp = generateRFC2822TimeStamp($row['modified_date'], $row['modified_time']);
    // --- BEGIN TYPE * ---
    //   |
    //   | These apply to everything
    // this is a stupid hack that maps the names of the '$row' array keys to those used
    // by the '$formVars' array (which is required by function 'generateCiteKey()')
    // (eventually, the '$formVars' array should use the MySQL field names as names for its array keys)
    $formVars = buildFormVarsArray($row);
    // function 'buildFormVarsArray()' is defined in 'include.inc.php'
    // generate or extract the cite key for this record
    // (note that charset conversion can only be done *after* the cite key has been generated,
    //  otherwise cite key generation will produce garbled text!)
    $citeKey = generateCiteKey($formVars);
    // function 'generateCiteKey()' is defined in 'include.inc.php'
    // Create an XML object for a single record.
    $record = new XML("mods");
    $record->setTagAttribute("version", "3.2");
    if (!empty($citeKey)) {
        $record->setTagAttribute("ID", $citeKey);
    }
    // titleInfo
    //   Regular Title
    if (!empty($row['title'])) {
        $record->setTagContent(encodeXMLField('title', $row['title']), "mods/titleInfo/title");
    }
    //   Translated Title
    //   NOTE: This field is excluded by the default cite SELECT method
    if (!empty($row['orig_title'])) {
        $orig_title = new XMLBranch("titleInfo");
        $orig_title->setTagAttribute("type", "translated");
        $orig_title->setTagContent(encodeXMLField('orig_title', $row['orig_title']), "titleInfo/title");
        $record->addXMLBranch($orig_title);
    }
    // name
    //   author
    if (!empty($row['author'])) {
        if (preg_match("/ *\\(eds?\\)\$/", $row['author'])) {
            $author = preg_replace("/[ \r\n]*\\(eds?\\)/i", "", $row['author']);
            $nameArray = separateNames("author", "/\\s*;\\s*/", "/\\s*,\\s*/", "/(?<=^|[{$word}])[^-{$word}]+|(?<=^|[{$upper}])(?=\$|[{$upper}])/{$patternModifiers}", $author, "personal", "editor");
        } else {
            if ($row['type'] == "Map") {
                $nameArray = separateNames("author", "/\\s*;\\s*/", "/\\s*,\\s*/", "/(?<=^|[{$word}])[^-{$word}]+|(?<=^|[{$upper}])(?=\$|[{$upper}])/{$patternModifiers}", $row['author'], "personal", "cartographer");
            } else {
                $nameArray = separateNames("author", "/\\s*;\\s*/", "/\\s*,\\s*/", "/(?<=^|[{$word}])[^-{$word}]+|(?<=^|[{$upper}])(?=\$|[{$upper}])/{$patternModifiers}", $row['author'], "personal", "author");
            }
        }
        foreach ($nameArray as $singleName) {
            $record->addXMLBranch($singleName);
        }
    }
    // originInfo
    if (!empty($row['year']) || !empty($row['publisher']) || !empty($row['place'])) {
        $origin = new XMLBranch("originInfo");
        // dateIssued
        if (!empty($row['year'])) {
            $origin->setTagContent(encodeXMLField('year', $row['year']), "originInfo/dateIssued");
        }
        // Book Chapters and Journal Articles only have a dateIssued
        // (editions, places, and publishers are associated with the host)
        if (!preg_match("/^(Book Chapter|Journal Article)\$/", $row['type'])) {
            // publisher
            if (!empty($row['publisher'])) {
                $origin->setTagContent(encodeXMLField('publisher', $row['publisher']), "originInfo/publisher");
            }
            // place
            if (!empty($row['place'])) {
                $origin->setTagContent(encodeXMLField('place', $row['place']), "originInfo/place/placeTerm");
                $origin->setTagAttribute("type", "text", "originInfo/place/placeTerm");
            }
            // edition
            if (!empty($row['edition'])) {
                $origin->setTagContent(encodeXMLField('edition', $row['edition']), "originInfo/edition");
            }
        }
        if ($origin->hasBranch()) {
            $record->addXMLBranch($origin);
//.........这里部分代码省略.........
开发者ID:Olari0,项目名称:Finugriling,代码行数:101,代码来源:modsxml.inc.php

示例4: openSearchGenerateBaseTags

function openSearchGenerateBaseTags($openSearchOperation)
{
    if ($openSearchOperation == "Error") {
        // OpenSearch Atom XML is used for diagnostics
        $atomCollection = atomGenerateBaseTags($openSearchOperation);
    } elseif ($openSearchOperation == "Description") {
        $atomCollection = new XML("OpenSearchDescription");
        $atomCollection->setTagAttribute("xmlns", "http://a9.com/-/spec/opensearch/1.1/");
        $atomCollection->setTagAttribute("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/");
        $atomCollection->setTagAttribute("xmlns:mozilla", "http://www.mozilla.org/2006/browser/search/");
    }
    return $atomCollection;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:13,代码来源:opensearch.inc.php

示例5: odfSpreadsheetTableRow

function odfSpreadsheetTableRow($recordExportArray, $rowType)
{
    // create an XML object for a single record
    $record = new XML("table:table-row");
    if ($rowType == "heading") {
        $record->setTagAttribute("table:style-name", "ro1");
        foreach ($recordExportArray as $odfIndex => $indexValue) {
            $tableCell = new XMLBranch("table:table-cell");
            $tableCell->setTagAttribute("office:value-type", "string");
            $tableCell->setTagContent($odfIndex, "table:table-cell/text:p");
            $record->addXMLBranch($tableCell);
        }
    } else {
        $record->setTagAttribute("table:style-name", "ro2");
        foreach ($recordExportArray as $odfIndex => $indexValue) {
            $tableCell = new XMLBranch("table:table-cell");
            if (!empty($indexValue)) {
                $tableCell->setTagAttribute("office:value-type", "string");
                $tableCell->setTagContent($indexValue, "table:table-cell/text:p");
            }
            $record->addXMLBranch($tableCell);
        }
    }
    return $record;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:25,代码来源:odfxml.inc.php

示例6: atomGenerateBaseTags

function atomGenerateBaseTags($atomOperation)
{
    global $officialDatabaseName;
    // these variables are specified in 'ini.inc.php'
    global $databaseBaseURL;
    global $feedbackEmail;
    global $contentTypeCharset;
    global $convertExportDataToUTF8;
    global $logoImageURL;
    global $faviconImageURL;
    global $query;
    $atomCollection = new XML("feed");
    $atomCollection->setTagAttribute("xmlns", "http://www.w3.org/2005/Atom");
    $atomCollection->setTagAttribute("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/");
    $atomCollection->setTagAttribute("xmlns:unapi", "http://unapi.info/");
    // NOTE: is the unAPI namespace ok? Or should we use "http://unapi.info/specs/", or maybe something like "http://purl.org/unapi/ns/" ?
    $atomCollection->setTagAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
    $atomCollection->setTagAttribute("xmlns:dcterms", "http://purl.org/dc/terms/");
    $atomCollection->setTagAttribute("xmlns:prism", "http://prismstandard.org/namespaces/1.2/basic/");
    $officialDatabaseNameConv = encodeHTMLspecialchars($officialDatabaseName);
    // function 'encodeHTMLspecialchars()' is defined in 'include.inc.php'
    if ($atomOperation != "Error") {
        // convert database name to UTF-8:
        // (if '$convertExportDataToUTF8' is set to "yes" in 'ini.inc.php' and character encoding is not UTF-8 already)
        if ($convertExportDataToUTF8 == "yes" and $contentTypeCharset != "UTF-8") {
            $officialDatabaseNameConv = convertToCharacterEncoding("UTF-8", "IGNORE", $officialDatabaseNameConv);
        }
        // function 'convertToCharacterEncoding()' is defined in 'include.inc.php'
    }
    // ----------------------------------------------------------
    // Add feed-level tags:
    // (not yet used: category, contributor, rights)
    // - 'title':
    addNewBranch($atomCollection, "title", array("type" => "text"), $officialDatabaseNameConv);
    // - 'subtitle':
    if ($atomOperation == "Error") {
        addNewBranch($atomCollection, "subtitle", array(), "Search error!");
    } else {
        // ...extract the 'WHERE' clause from the SQL query to include a natural-language version (well, sort of) within the 'subtitle' element:
        $queryWhereClause = extractWHEREclause($query);
        // function 'extractWHEREclause()' is defined in 'include.inc.php'
        // construct a meaningful feed description based on the actual 'WHERE' clause:
        // TODO: For Atom XML, the query string should not get HTML encoded!
        $subTitle = "Displays records where " . encodeHTML(explainSQLQuery($queryWhereClause));
        // functions 'encodeHTML()' and 'explainSQLQuery()' are defined in 'include.inc.php'
        addNewBranch($atomCollection, "subtitle", array(), $subTitle);
    }
    // - 'updated':
    //    (TODO: the timestamp in the 'updated' element should really only get updated if any of the matching records was updated, right?)
    addNewBranch($atomCollection, "updated", array(), generateISO8601TimeStamp());
    // function 'generateISO8601TimeStamp()' is defined in 'include.inc.php'
    // - 'author':
    $authorBranch = new XMLBranch("author");
    $authorBranch->setTagContent($officialDatabaseNameConv, "author/name");
    $authorBranch->setTagContent($feedbackEmail, "author/email");
    $authorBranch->setTagContent($databaseBaseURL, "author/uri");
    $atomCollection->addXMLBranch($authorBranch);
    // - 'generator', 'icon', 'logo':
    addNewBranch($atomCollection, "generator", array("uri" => "http://www.refbase.net/", "version" => "0.9.5"), "Web Reference Database (http://refbase.sourceforge.net)");
    addNewBranch($atomCollection, "icon", array(), $databaseBaseURL . $faviconImageURL);
    addNewBranch($atomCollection, "logo", array(), $databaseBaseURL . $logoImageURL);
    // - 'link' (more links will be added in function 'atomCollection()'):
    //   - link to OpenSearch Description file:
    atomLink($atomCollection, $databaseBaseURL . "opensearch.php?operation=explain", "search", "OpenSearch", $officialDatabaseNameConv);
    //   - link to unAPI server:
    atomLink($atomCollection, $databaseBaseURL . "unapi.php", "unapi:unapi-server", "unAPI", "unAPI");
    return $atomCollection;
}
开发者ID:Olari0,项目名称:Finugriling,代码行数:68,代码来源:atomxml.inc.php

示例7: oaidcRecord


//.........这里部分代码省略.........
    // - the variable '$fileVisibility' is set to 'login' AND the user is logged in
    // - the variable '$fileVisibility' is set to 'user-specific' AND the 'user_permissions' session variable contains 'allow_download'
    // - the array variable '$fileVisibilityException' (defined in 'ini.inc.php') contains a pattern (in array element 1) that matches the contents of the field given (in array element 0)
    //
    // TODO: - the URL-generating code should be made into a dedicated function (since it's shared with 'modsxml.inc.php' and 'atomxml.inc.php')
    $printURL = false;
    if ($fileVisibility == "everyone" or $fileVisibility == "login" and isset($_SESSION['loginEmail']) or $fileVisibility == "user-specific" and (isset($_SESSION['user_permissions']) and preg_match("/allow_download/", $_SESSION['user_permissions'])) or !empty($fileVisibilityException) and preg_match($fileVisibilityException[1], $row[$fileVisibilityException[0]])) {
        if (!empty($row['file'])) {
            if (preg_match('#^(https?|ftp|file)://#i', $row['file'])) {
                $URLprefix = "";
                // we don't alter the URL given in the 'file' field
            } else {
                // use the base URL of the standard files directory as prefix:
                if (preg_match('#^/#', $filesBaseURL)) {
                    // absolute path -> file dir is located outside of refbase root dir
                    $URLprefix = 'http://' . $_SERVER['HTTP_HOST'] . $filesBaseURL;
                } else {
                    // relative path -> file dir is located within refbase root dir
                    $URLprefix = $databaseBaseURL . $filesBaseURL;
                }
            }
            $printURL = true;
        }
    }
    // ----------------------------------------------------------
    // Start OAI_DC XML record:
    if (!empty($metadataPrefix)) {
        $recordPrefix = $metadataPrefix . ":";
    }
    $record = new XML($recordPrefix . "dc");
    // create an XML object for a single record
    if ($addNameSpaceInfo) {
        if ($metadataPrefix == "oai_dc") {
            $record->setTagAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/");
        } elseif ($metadataPrefix == "srw_dc") {
            $record->setTagAttribute("xmlns:srw_dc", "info:srw/schema/1/dc-v1.1");
        }
        $record->setTagAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
        if ($metadataPrefix == "oai_dc") {
            $record->setTagAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            $record->setTagAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd");
        } elseif ($metadataPrefix == "srw_dc") {
            $record->setTagAttribute("xmlns:prism", "http://prismstandard.org/namespaces/1.2/basic/");
        }
    }
    // Add Dublin Core elements:
    // NOTE: With a few exceptions, we try to adhere to the guidelines given at
    //       "Using simple Dublin Core to describe eprints" by Andy Powell et al.
    //       See: <http://eprints-uk.rdn.ac.uk/project/docs/simpledc-guidelines/>
    // - 'dc:title':
    if (!empty($row['title'])) {
        addMetaElement($record, "dc", "title", array(), $row['title']);
    }
    // function 'addMetaElement()' is defined in 'webservice.inc.php'
    // - 'dc:creator':
    if (!empty($row['author']) and $row['author'] != $row['editor']) {
        addMetaElement($record, "dc", "creator", array(), $row['author']);
    }
    // - 'dc:creator':
    //   TODO: add refbase corporate author(s) as 'dc:creator'
    // - 'dc:contributor':
    if (!empty($row['editor'])) {
        addMetaElement($record, "dc", "contributor", array(), $row['editor']);
    }
    // - 'dc:description':
    if (!empty($row['abstract'])) {
开发者ID:Olari0,项目名称:Finugriling,代码行数:67,代码来源:oaidcxml.inc.php


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