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


PHP fDOMDocument::createElementNS方法代码示例

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


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

示例1: __construct

 /**
  * @param string       $name
  * @param \SplFileInfo $file
  */
 public function __construct($name = NULL, \SplFileInfo $file = NULL) {
     if ($this->rootName === NULL) {
         throw new UnitObjectException('No or invalid rootname set', UnitObjectException::InvalidRootname);
     }
     $this->dom = new fDOMDocument('1.0', 'UTF-8');
     $this->dom->registerNamespace('phpdox', self::XMLNS);
     $this->rootNode = $this->dom->createElementNS(self::XMLNS, $this->rootName);
     $this->dom->appendChild($this->rootNode);
     if ($name !== NULL) {
         $this->setName($name, $this->rootNode);
     }
     if ($file !== NULL) {
         $this->setFileHeader($file);
     }
     $this->setAbstract(FALSE);
     $this->setFinal(FALSE);
 }
开发者ID:rxz135cc,项目名称:yii2webApp,代码行数:21,代码来源:AbstractUnitObject.php

示例2: getGeneralBuildInfo

 private function getGeneralBuildInfo()
 {
     if ($this->buildInfo != NULL) {
         return $this->buildInfo;
     }
     $dom = new fDOMDocument();
     $this->buildInfo = $dom->createDocumentFragment();
     $dateNode = $dom->createElementNS(self::XMLNS, 'date');
     $this->buildInfo->appendChild($dateNode);
     $date = new \DateTime('now');
     $dateNode->setAttribute('unix', $date->getTimestamp());
     $dateNode->setAttribute('date', $date->format('d-m-Y'));
     $dateNode->setAttribute('time', $date->format('H:i:s'));
     $dateNode->setAttribute('iso', $date->format('c'));
     $dateNode->setAttribute('rfc', $date->format('r'));
     $phpdoxNode = $dom->createElementNS(self::XMLNS, 'phpdox');
     $this->buildInfo->appendChild($phpdoxNode);
     $phpdoxNode->setAttribute('version', $this->version->getVersion());
     $phpdoxNode->setAttribute('info', $this->version->getInfoString());
     $phpdoxNode->setAttribute('generated', $this->version->getGeneratedByString());
     $phpdoxNode->setAttribute('phar', defined('PHPDOX_PHAR') ? 'yes' : 'no');
     foreach ($this->enrichers as $enricher) {
         $enricherNode = $phpdoxNode->appendElementNS(self::XMLNS, 'enricher');
         $enricherNode->setAttribute('type', $enricher);
     }
     $phpNode = $dom->createElementNS(self::XMLNS, 'php');
     $this->buildInfo->appendChild($phpNode);
     $phpNode->setAttribute('version', PHP_VERSION);
     $phpNode->setAttribute('os', PHP_OS);
     foreach (get_loaded_extensions(true) as $extension) {
         $extNode = $dom->createElementNS(self::XMLNS, 'zendextension');
         $extNode->setAttribute('name', $extension);
         $phpNode->appendChild($extNode);
     }
     foreach (get_loaded_extensions(false) as $extension) {
         $extNode = $dom->createElementNS(self::XMLNS, 'extension');
         $extNode->setAttribute('name', $extension);
         $phpNode->appendChild($extNode);
     }
     return $this->buildInfo;
 }
开发者ID:mostwanted1976,项目名称:phpdox,代码行数:41,代码来源:Build.php

示例3: processFinding

 protected function processFinding(fDOMDocument $dom, $ref, \DOMElement $finding)
 {
     $enrichment = $this->getEnrichtmentContainer($ref, 'checkstyle');
     $enrichFinding = $dom->createElementNS(self::XMLNS, $finding->getAttribute('severity', 'error'));
     $enrichment->appendChild($enrichFinding);
     foreach ($finding->attributes as $attr) {
         if ($attr->localName == 'severity') {
             continue;
         }
         $enrichFinding->setAttributeNode($dom->importNode($attr, true));
     }
 }
开发者ID:webkingashu,项目名称:phpdox,代码行数:12,代码来源:CheckStyle.php

示例4: asDom

 public function asDom(\TheSeer\fDOM\fDOMDocument $ctx)
 {
     $node = $ctx->createElementNS('http://xml.phpdox.net/src#', strtolower($this->name));
     foreach ($this->attributes as $attribute => $value) {
         $node->setAttribute($attribute, $value);
     }
     if ($this->body !== null && $this->body !== '') {
         $parser = $this->factory->getInstanceFor('InlineProcessor', $ctx);
         $node->appendChild($parser->transformToDom($this->body));
     }
     return $node;
 }
开发者ID:sakshika,项目名称:ATM,代码行数:12,代码来源:GenericElement.php

示例5: asDom

 public function asDom(\TheSeer\fDOM\fDOMDocument $ctx)
 {
     $node = $ctx->createElementNS('http://xml.phpdox.net/src', 'invalid');
     $node->setAttribute('annotation', $this->name);
     foreach ($this->attributes as $attribute => $value) {
         $node->setAttribute($attribute, $value);
     }
     if ($this->body !== null && $this->body !== '') {
         $node->appendChild($ctx->createTextnode($this->body));
     }
     return $node;
 }
开发者ID:theseer,项目名称:phpdox,代码行数:12,代码来源:InvalidElement.php

示例6: asDom

 /**
  * @param \TheSeer\fDOM\fDOMDocument $doc
  * @return \TheSeer\fDOM\fDOMElement
  */
 public function asDom(\TheSeer\fDOM\fDOMDocument $doc)
 {
     $node = $doc->createElementNS('http://xml.phpdox.net/src#', 'docblock');
     // add lines and such?
     foreach ($this->elements as $element) {
         if (is_array($element)) {
             foreach ($element as $el) {
                 $node->appendChild($el->asDom($doc));
             }
             continue;
         }
         $node->appendChild($element->asDom($doc));
     }
     return $node;
 }
开发者ID:sakshika,项目名称:ATM,代码行数:19,代码来源:DocBlock.php

示例7: processViolations

 private function processViolations(fDOMDocument $dom, \DOMNodeList $violations)
 {
     foreach ($violations as $violation) {
         /** @var fDOMElement $violation */
         $line = $violation->getAttribute('beginline');
         $ref = $dom->queryOne(sprintf('//phpdox:*/*[@line = %d or (@start <= %d and @end >= %d)]', $line, $line, $line));
         if (!$ref) {
             // One src file may contain multiple classes/traits/interfaces, so the
             // finding might not apply to the current object since violations are based on filenames
             // but we have individual objects - so we just ignore the finding for this context
             continue;
         }
         $enrichment = $this->getEnrichtmentContainer($ref, 'pmd');
         $enrichViolation = $dom->createElementNS(self::XMLNS, 'violation');
         $enrichment->appendChild($enrichViolation);
         $enrichViolation->setAttribute('message', trim($violation->nodeValue));
         foreach ($violation->attributes as $attr) {
             $enrichViolation->setAttributeNode($dom->importNode($attr, true));
         }
     }
 }
开发者ID:mostwanted1976,项目名称:phpdox,代码行数:21,代码来源:PHPMessDetector.php

示例8: processFindings

 private function processFindings(fDOMDocument $dom, \DOMNodeList $findings)
 {
     foreach ($findings as $finding) {
         /** @var fDOMElement $finding */
         $line = $finding->getAttribute('line');
         $ref = $dom->queryOne(sprintf('//phpdox:*/*[@line = %d or (@start <= %d and @end >= %d)]', $line, $line, $line));
         if (!$ref) {
             // One src file may contain multiple classes/traits/interfaces, so the
             // finding might not apply to the current object since findings are based on filenames
             // but we have individual objects - so we just ignore the finding for this context
             continue;
         }
         $enrichment = $this->getEnrichtmentContainer($ref, 'checkstyle');
         $enrichFinding = $dom->createElementNS(self::XMLNS, $finding->getAttribute('severity', 'error'));
         $enrichment->appendChild($enrichFinding);
         foreach ($finding->attributes as $attr) {
             if ($attr->localName == 'severity') {
                 continue;
             }
             $enrichFinding->setAttributeNode($dom->importNode($attr, true));
         }
     }
 }
开发者ID:sakshika,项目名称:ATM,代码行数:23,代码来源:CheckStyle.php

示例9: testDocBlockWithMultipleOccurencesOfAnnotationCanBeSerializedToDom

 public function testDocBlockWithMultipleOccurencesOfAnnotationCanBeSerializedToDom()
 {
     $dom = new fDOMDocument();
     $dom->registerNamespace('test', 'http://xml.phpdox.net/src');
     $element2 = clone $this->element;
     $this->element->expects($this->once())->method('asDom')->will($this->returnValue($dom->createElementNS('http://xml.phpdox.net/src', 'stub')));
     $element2->expects($this->once())->method('asDom')->will($this->returnValue($dom->createElementNS('http://xml.phpdox.net/src', 'stub')));
     $this->docBlock->appendElement($this->element);
     $this->docBlock->appendElement($element2);
     $node = $this->docBlock->asDom($dom);
     $this->assertEquals('<docblock xmlns="http://xml.phpdox.net/src"><stub/><stub/></docblock>', $dom->saveXML($node));
 }
开发者ID:beingsane,项目名称:phpdox,代码行数:12,代码来源:docblockTest.php

示例10: testSettingContentAsTextNodeForNewElementWithNamespaceEncodesEntities

 public function testSettingContentAsTextNodeForNewElementWithNamespaceEncodesEntities()
 {
     $node = $this->dom->createElementNS('test:uri', 'test', "test &amp; demo", TRUE);
     $this->assertInstanceOf('TheSeer\\fDOM\\fDOMElement', $node);
     $this->assertEquals('test &amp; demo', $node->nodeValue);
 }
开发者ID:KingNoosh,项目名称:Teknik,代码行数:6,代码来源:fDOMDocument.test.php


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