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


PHP DOMElement::setAttribute方法代码示例

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


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

示例1: serialize

 /**
  * serialize
  *
  * @param Sabre_DAV_Server $server
  * @param DOMElement       $prop
  * @return void
  */
 public function serialize(Sabre_DAV_Server $server, DOMElement $prop)
 {
     $doc = $prop->ownerDocument;
     $prop->setAttribute('xmlns:b', 'urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
     $prop->setAttribute('b:dt', 'dateTime.rfc1123');
     $prop->nodeValue = Sabre_HTTP_Util::toHTTPDate($this->time);
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:14,代码来源:GetLastModified.php

示例2: createUrlSet

 private function createUrlSet()
 {
     $this->dom = new \DOMDocument('1.0', 'UTF-8');
     $this->urlset = $this->dom->createElement("urlset");
     $this->urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     $this->dom->appendChild($this->urlset);
 }
开发者ID:webremote,项目名称:Sitemap-Craft-Plugin,代码行数:7,代码来源:Sitemap_RenderController.php

示例3: addUserFormatAttribute

 public function addUserFormatAttribute(DOMElement $node, $is_anonymous)
 {
     $node->setAttribute('format', $is_anonymous ? 'email' : 'username');
     if ($is_anonymous) {
         $node->setAttribute('is_anonymous', "1");
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:ArtifactXMLNodeHelper.class.php

示例4: appendNamespaces

 public function appendNamespaces(DOMElement $node)
 {
     $node->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
     $node->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $node->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
     $node->setAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
 }
开发者ID:jberkel,项目名称:tool,代码行数:7,代码来源:AtomGenerator.php

示例5: injectsBounds

 /**
  * Injects bound in node
  *
  * @param \DOMElement $node
  * @param ResultInterface $bound
  */
 private function injectsBounds(\DOMElement $node, ResultInterface $bound)
 {
     $node->setAttribute('loc', $bound->getSum('loc'));
     $node->setAttribute('lloc', $bound->getSum('logicalLoc'));
     $node->setAttribute('cyclomaticComplexity', $bound->getAverage('cyclomaticComplexity'));
     $node->setAttribute('maintainabilityIndex', $bound->getAverage('maintainabilityIndex'));
     $node->setAttribute('volume', $bound->getAverage('volume'));
     $node->setAttribute('vocabulary', $bound->getAverage('vocabulary'));
     $node->setAttribute('difficulty', $bound->getAverage('difficulty'));
     $node->setAttribute('effort', $bound->getAverage('effort'));
     $node->setAttribute('bugs', $bound->getAverage('bugs'));
     $node->setAttribute('time', $bound->getAverage('time'));
     $node->setAttribute('intelligentContent', $bound->getAverage('intelligentContent'));
     $node->setAttribute('commentWeight', $bound->getAverage('commentWeight'));
     $node->setAttribute('length', $bound->getAverage('length'));
     $hasOOP = null !== $bound->getSum('instability');
     if ($hasOOP) {
         $node->setAttribute('lcom', $bound->getAverage('lcom'));
         $node->setAttribute('instability', $bound->getAverage('instability'));
         $node->setAttribute('efferentCoupling', $bound->getAverage('efferentCoupling'));
         $node->setAttribute('afferentCoupling', $bound->getAverage('afferentCoupling'));
         $node->setAttribute('sysc', $bound->getAverage('sysc'));
         $node->setAttribute('rsysc', $bound->getAverage('rsysc'));
         $node->setAttribute('dc', $bound->getAverage('dc'));
         $node->setAttribute('rdc', $bound->getAverage('rdc'));
         $node->setAttribute('sc', $bound->getAverage('sc'));
         $node->setAttribute('rsc', $bound->getAverage('rsc'));
         $node->setAttribute('noc', $bound->getSum('noc'));
         $node->setAttribute('noca', $bound->getSum('noca'));
         $node->setAttribute('nocc', $bound->getSum('nocc'));
         $node->setAttribute('noi', $bound->getSum('noi'));
         $node->setAttribute('nom', $bound->getSum('nom'));
     }
 }
开发者ID:YuraLukashik,项目名称:PhpMetrics,代码行数:40,代码来源:Xml.php

示例6: generateXML

 public static function generateXML(DOMElement $fieldtype)
 {
     $fieldtype->setAttribute('name', self::TYPE);
     $fieldtype->setAttribute('class', 'solr.StrField');
     $fieldtype->setAttribute('sortMissingLast', 'true');
     $fieldtype->setAttribute('omitNorms', 'true');
     return $fieldtype;
 }
开发者ID:Zoxive,项目名称:Kohana-Solr,代码行数:8,代码来源:string.php

示例7: serialize

 /**
  * serialize 
  * 
  * @param DOMElement $prop 
  * @return void
  */
 public function serialize(Sabre_DAV_Server $server, DOMElement $prop)
 {
     $doc = $prop->ownerDocument;
     $prop->setAttribute('xmlns:b', 'urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
     $prop->setAttribute('b:dt', 'dateTime.rfc1123');
     $date = new DateTime('@' . $this->time, new DateTimeZone('UTC'));
     $prop->nodeValue = $date->format(DATE_RFC1123);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:14,代码来源:GetLastModified.php

示例8: __construct

 /**
  * SiteMap constructor.
  *
  * @param string $domain
  */
 public function __construct($domain)
 {
     $this->sitemap = new DOMDocument('1.0', 'UTF-8');
     $this->sitemap->preserveWhiteSpace = false;
     $this->sitemap->formatOutput = true;
     $this->urlset = $this->sitemap->appendChild($this->sitemap->createElement('urlset'));
     $this->urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     $this->setDomain($domain);
 }
开发者ID:Hiroto-K,项目名称:HkApps,代码行数:14,代码来源:SiteMap.php

示例9: _setRootElement

 /**
  * Set an element as root.
  * 
  * @param DOMElement $rootElement
  * @return DOMElement The root element, including required attributes.
  */
 protected function _setRootElement($rootElement)
 {
     $rootElement->setAttribute('xmlns', self::XMLNS);
     $rootElement->setAttribute('xmlns:xsi', self::XMLNS_XSI);
     $rootElement->setAttribute('xsi:schemaLocation', self::XMLNS . ' ' . self::XMLNS_SCHEMALOCATION);
     $rootElement->setAttribute('uri', $this->_buildUrl());
     $rootElement->setAttribute('accessDate', date('c'));
     return $rootElement;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:15,代码来源:AbstractOmekaXml.php

示例10: gerneateXML

 public static function gerneateXML(DOMElement $fieldtype)
 {
     $fieldtype->setAttribute('name', self::TYPE);
     $fieldtype->setAttribute('class', 'solr.TrieFloatField');
     $fieldtype->setAttribute('precisionStep', 0);
     $fieldtype->setAttribute('omitNorms', 'true');
     $fieldtype->setAttribute('positionIncrementGap', 0);
     return $fieldtype;
 }
开发者ID:Zoxive,项目名称:Kohana-Solr,代码行数:9,代码来源:float.php

示例11: add

 public function add($name, $href, $minAuthLevel, $maxAuthLevel)
 {
     $element = new \DOMElement('Item');
     $element->setAttribute('name', $name);
     $element->setAttribute('href', $href);
     $element->setAttribute('minAuthLevel', $minAuthLevel);
     $element->setAttribute('maxAuthLevel', $maxAuthLevel);
     $this->xml->appendChild($element);
 }
开发者ID:DamdamD,项目名称:Website,代码行数:9,代码来源:NavBackManager.php

示例12: setAttribute

 /**
  * Set XML property or method argument value.
  *
  * @param string      $value
  * @param \DOMElement $node
  * @param ClassMetadata[]       $classesMetadata
  */
 protected function setAttribute(string $value, \DOMElement $node, array $classesMetadata)
 {
     if (array_key_exists($value, $classesMetadata)) {
         $node->setAttribute('service', $value);
     } elseif (class_exists($value)) {
         $node->setAttribute('class', $value);
     } else {
         $node->setAttribute('value', $value);
     }
 }
开发者ID:samsonos,项目名称:php_core,代码行数:17,代码来源:XMLBuilder.php

示例13: __construct

 public function __construct()
 {
     // create a new dom object
     $this->oDocument = new DOMDocument('1.0', 'UTF-8');
     $this->oDocument->formatOutput = true;
     // add a root node with the name specified in the implementing class
     $this->oRootNode = $this->oDocument->createElement($this->sRootNodeName);
     $this->oRootNode->setAttribute('xmlns', $this->sXMLNamespace);
     $this->oDocument->appendChild($this->oRootNode);
 }
开发者ID:JanChristiansen,项目名称:LargeXMLSitemap,代码行数:10,代码来源:abstract.xmlSitemapBase.php

示例14: getInstallListing

 /**
  * @param string $cut
  * @param DOMElement $parentNode
  */
 protected function getInstallListing($directory, $cut, $parentNode)
 {
     $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS));
     foreach ($objects as $name => $object) {
         $file = ltrim(str_replace($cut, '', $name), '/');
         $as = ltrim(str_replace($directory, '', $name), '/');
         $parentNode->appendChild($node = new DOMElement('install'));
         $node->setAttribute('name', $file);
         $node->setAttribute('as', $as);
     }
 }
开发者ID:mathroc,项目名称:php-vfs,代码行数:15,代码来源:package.php

示例15: _appendContentModeratorXml

 /**
  * @param DOMElement $rootNode
  * @param array $moderator
  */
 protected function _appendContentModeratorXml(DOMElement $rootNode, $moderator)
 {
     $document = $rootNode->ownerDocument;
     $rootNode->setAttribute('content_id', $moderator['content_id']);
     $rootNode->setAttribute('content_type', $moderator['content_type']);
     $rootNode->setAttribute('username', $moderator['username']);
     $rootNode->setAttribute('user_id', $moderator['user_id']);
     $permissionsNode = $document->createElement('moderator_permissions');
     $rootNode->appendChild($permissionsNode);
     $permissionsNode->appendChild(XenForo_Helper_DevelopmentXml::createDomCdataSection($document, $moderator['moderator_permissions']));
 }
开发者ID:ThemeHouse-XF,项目名称:Moderatorsa,代码行数:15,代码来源:Moderator.php


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