当前位置: 首页>>代码示例>>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;未经允许,请勿转载。