本文整理汇总了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);
}
示例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);
}
示例3: addUserFormatAttribute
public function addUserFormatAttribute(DOMElement $node, $is_anonymous)
{
$node->setAttribute('format', $is_anonymous ? 'email' : 'username');
if ($is_anonymous) {
$node->setAttribute('is_anonymous', "1");
}
}
示例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/');
}
示例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'));
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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']));
}