當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLWriter::startAttributeNs方法代碼示例

本文整理匯總了PHP中XMLWriter::startAttributeNs方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLWriter::startAttributeNs方法的具體用法?PHP XMLWriter::startAttributeNs怎麽用?PHP XMLWriter::startAttributeNs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLWriter的用法示例。


在下文中一共展示了XMLWriter::startAttributeNs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beginWriteProperty

 /**
  * Write a property
  *
  * @param ODataProperty &$odataProperty Property to be written
  * @param boolean       $isTopLevel     is link top level or not.
  * 
  * @return nothing
  */
 protected function beginWriteProperty(ODataProperty &$odataProperty, $isTopLevel)
 {
     $this->xmlWriter->startElementNS(ODataConstants::ODATA_NAMESPACE_PREFIX, $odataProperty->name, null);
     if ($odataProperty->typeName != null) {
         $this->xmlWriter->startAttributeNs(ODataConstants::ODATA_METADATA_NAMESPACE_PREFIX, ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, null);
         $this->xmlWriter->text($odataProperty->typeName);
     }
     if ($isTopLevel) {
         $this->xmlWriter->startAttribute(ODataConstants::XMLNS_NAMESPACE_PREFIX);
         $this->xmlWriter->text(ODataConstants::ODATA_METADATA_NAMESPACE);
         $this->xmlWriter->startAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ODATA_NAMESPACE_PREFIX, null);
         $this->xmlWriter->text(ODataConstants::ODATA_NAMESPACE);
         $this->xmlWriter->startAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ODATA_METADATA_NAMESPACE_PREFIX, null);
         $this->xmlWriter->text(ODataConstants::ODATA_METADATA_NAMESPACE);
     }
     if ($odataProperty->typeName != null || $isTopLevel) {
         $this->xmlWriter->endAttribute();
     }
 }
開發者ID:maxromanov,項目名稱:odataphpprod,代碼行數:27,代碼來源:AtomODataWriter.php

示例2: function

setFn('Render', function ($Call) {
    $XML = new XMLWriter();
    $XML->openMemory();
    $XML->startDocument('1.0', 'UTF-8');
    $XML->setIndent(true);
    if (isset($Call['Output']['Root'])) {
        $XML->startElement($Call['Output']['Root']);
        if (isset($Call['Namespace'])) {
            $XML->startAttribute('xmlns');
            $XML->text($Call['Namespace']);
            $XML->endAttribute();
        }
        if (isset($Call['Attributes'])) {
            foreach ($Call['Attributes'] as $Key => $Value) {
                if (is_array($Value)) {
                    $XML->startAttributeNs($Value['Prefix'], $Value['Key'], null);
                    $XML->text($Value['Value']);
                } else {
                    $XML->startAttribute($Key);
                    $XML->text($Value);
                }
                $XML->endAttribute();
            }
        }
        $Root = '';
        F::Map($Call['Output']['Content'], function ($Key, $Value) use($XML, &$Root) {
            if (substr($Key, 0, 1) == '@') {
                $XML->startAttribute(substr($Key, 1));
                $XML->text($Value);
                $XML->endAttribute();
            } else {
開發者ID:trickyplan,項目名稱:codeine,代碼行數:31,代碼來源:XML.php


注:本文中的XMLWriter::startAttributeNs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。