當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。