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


PHP DOMElement::getNodePath方法代码示例

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


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

示例1: normalizeStyleAttributes

 /**
  * Normalizes the value of the "style" attribute and saves it.
  *
  * @param \DOMElement $node
  *
  * @return void
  */
 private function normalizeStyleAttributes(\DOMElement $node)
 {
     $normalizedOriginalStyle = preg_replace_callback('/[A-z\\-]+(?=\\:)/S', function (array $m) {
         return strtolower($m[0]);
     }, $node->getAttribute('style'));
     // in order to not overwrite existing style attributes in the HTML, we
     // have to save the original HTML styles
     $nodePath = $node->getNodePath();
     if (!isset($this->styleAttributesForNodes[$nodePath])) {
         $this->styleAttributesForNodes[$nodePath] = $this->parseCssDeclarationsBlock($normalizedOriginalStyle);
         $this->visitedNodes[$nodePath] = $node;
     }
     $node->setAttribute('style', $normalizedOriginalStyle);
 }
开发者ID:peterfox,项目名称:emogrifier,代码行数:21,代码来源:Emogrifier.php

示例2: getNodeLevel

 /**
  * Retorna o nível do nó.
  * @param \DOMElement $node
  * @return int
  */
 public function getNodeLevel(\DOMElement $node)
 {
     return count(explode('/', $node->getNodePath())) - 1;
 }
开发者ID:charlanalves,项目名称:sped,代码行数:9,代码来源:Schema.php

示例3: getFormNodeId

 /**
  * Returns form node unique identifier.
  *
  * @param \DOMElement $form
  *
  * @return string
  */
 private function getFormNodeId(\DOMElement $form)
 {
     return md5($form->getLineNo() . $form->getNodePath() . $form->nodeValue);
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:11,代码来源:BrowserKitDriver.php

示例4: createFixtureObject

 /**
  * @param DOMElement $objElement
  * @param $objParent
  * @param $strClassName
  * @param $arrParameters
  * @param $strName
  * @return class_model
  */
 protected function createFixtureObject(DOMElement $objElement, $objParent, $strClassName, $arrParameters, $strName)
 {
     $strParentId = $objParent === null ? $this->getDefaultRootId($strClassName) : $objParent->getStrSystemid();
     // resolve references
     foreach ($arrParameters as $strKey => $strValue) {
         if (substr($strValue, 0, 11) == 'objectlist:') {
             $strRef = trim(substr($strValue, 11));
             $arrRefs = explode(",", $strRef);
             $arrParameters[$strKey] = array();
             foreach ($arrRefs as $strRefKey) {
                 $objRef = $this->getObject($strRefKey);
                 if ($objRef instanceof class_model) {
                     $arrParameters[$strKey][] = $objRef;
                 } else {
                     throw new RuntimeException('Object "' . $strName . '" refers to an non existing object (' . $objElement->getNodePath() . ')');
                 }
             }
         } else {
             if (substr($strValue, 0, 4) == 'ref:') {
                 $strRef = trim(substr($strValue, 4));
                 $objRef = $this->getObject($strRef);
                 if ($objRef instanceof class_model) {
                     $arrParameters[$strKey] = $objRef->getStrSystemid();
                 } else {
                     throw new RuntimeException('Object "' . $strName . '" refers to an non existing object (' . $objElement->getNodePath() . ')');
                 }
             }
         }
     }
     $objObject = $this->createObject($strClassName, $strParentId, array(), $arrParameters, false);
     return $objObject;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:40,代码来源:class_testbase_object.php

示例5: parseObjectValue

 /**
  * 
  * Parse value of the object
  * 
  * @param Object $obj
  * @param DOMElement $element
  * 
  * @return DOMElement
  */
 private function parseObjectValue($obj, $element)
 {
     $this->logger->debug("Start with:" . $element->getNodePath());
     $refl = new \ReflectionClass($obj);
     $classDocs = $this->parseDocComments($refl->getDocComment());
     $classProps = $refl->getProperties();
     $namespace = $classDocs['xmlNamespace'];
     foreach ($classProps as $prop) {
         $propDocs = $this->parseDocComments($prop->getDocComment());
         //print_r($prop->getDocComment());
         if (is_object($prop->getValue($obj))) {
             $code = '';
             //print($propDocs['xmlName']."\n");
             if (array_key_exists('xmlNamespace', $propDocs)) {
                 $code = $this->getNsCode($propDocs['xmlNamespace']);
                 $el = $this->dom->createElement($code . ":" . $propDocs['xmlName']);
                 $el = $this->parseObjectValue($prop->getValue($obj), $el);
             } else {
                 $el = $this->dom->createElement($propDocs['xmlName']);
                 $el = $this->parseObjectValue($prop->getValue($obj), $el);
             }
             //print_r("Value is object in Parse\n");
             $element->appendChild($el);
         } else {
             //Next function fixes SDK-78
             $this->castToStringZero($prop, $obj);
             // end
             if ($prop->getValue($obj) != '') {
                 if ($propDocs['xmlType'] == 'element') {
                     $el = '';
                     $code = $this->getNsCode($propDocs['xmlNamespace']);
                     $value = $prop->getValue($obj);
                     if (is_array($value)) {
                         // Strip the class prefix, if one exists
                         if ($this->classPrefix && 0 == strpos($propDocs['xmlName'], $this->classPrefix)) {
                             $propDocs['xmlName'] = substr($propDocs['xmlName'], strlen($this->classPrefix));
                         }
                         $this->logger->debug("Creating element:" . $code . ":" . $propDocs['xmlName']);
                         $this->logger->debug(print_r($value, true));
                         foreach ($value as $node) {
                             $this->logger->debug(print_r($node, true));
                             $el = $this->dom->createElement($code . ":" . $propDocs['xmlName']);
                             $arrNode = $this->parseObjectValue($node, $el);
                             $element->appendChild($arrNode);
                         }
                     } else {
                         //SDK-39
                         $el = $this->dom->createElement($code . ":" . $propDocs['xmlName'], $value);
                         $element->appendChild($el);
                     }
                     //print_r("Added element ".$propDocs['xmlName']." with NS = ".$propDocs['xmlNamespace']." \n");
                 } elseif ($propDocs['xmlType'] == 'attribute') {
                     $atr = $this->dom->createAttribute($propDocs['xmlName']);
                     $text = $this->dom->createTextNode($prop->getValue($obj));
                     $atr->appendChild($text);
                     $element->appendChild($atr);
                 } elseif ($propDocs['xmlType'] == 'value') {
                     $this->logger->debug(print_r($prop->getValue($obj), true));
                     $txtNode = $this->dom->createTextNode($prop->getValue($obj));
                     $element->appendChild($txtNode);
                 }
             }
         }
     }
     return $element;
 }
开发者ID:andrewhook,项目名称:oauth-php,代码行数:75,代码来源:Php2Xml.php

示例6: retriveVisibility

 /**
  * Retrieve visibility 
  * 
  * @param \DOMElement $element
  * @return type
  */
 public function retriveVisibility(\DOMElement $element)
 {
     $name = $this->engine->query($element->getNodePath() . '/dia:attribute[@name="visibility"]/dia:enum');
     $propertyVisibility = $name->item(0)->attributes->getNamedItem('val')->nodeValue;
     return self::$propertyVisibilityTypes[$propertyVisibility];
 }
开发者ID:davro,项目名称:fabrication,代码行数:12,代码来源:UML.php

示例7: normalizeStyleAttributes

 /**
  * Normalizes the value of the "style" attribute and saves it.
  *
  * @param \DOMElement $node
  *
  * @return void
  */
 private function normalizeStyleAttributes(\DOMElement $node)
 {
     $normalizedOriginalStyle = $node->getAttribute('style');
     // in order to not overwrite existing style attributes in the HTML, we
     // have to save the original HTML styles
     $nodePath = $node->getNodePath();
     if (!isset($this->styleAttributesForNodes[$nodePath])) {
         $this->styleAttributesForNodes[$nodePath] = $this->parseCssDeclarationBlock($normalizedOriginalStyle);
         $this->visitedNodes[$nodePath] = $node;
     }
     $node->setAttribute('style', $normalizedOriginalStyle);
 }
开发者ID:vanderlee,项目名称:emogrifier,代码行数:19,代码来源:Emogrifier.php

示例8: parseCondition

 /**
  * Parse conditions that are used to see whether you are allowed to perform certain actions on the scheme
  *
  * @param One_Scheme $scheme
  * @param DOMXPath $xpath
  * @param DOMElement $element
  * @param string $name name of the rule
  * @return One_Permission_Rule
  */
 protected static function parseCondition(One_Scheme $scheme, DOMXPath $xpath, DOMElement $element, $name = NULL)
 {
     foreach (array('rule', 'and', 'or') as $roa) {
         $currs = $xpath->query($element->getNodePath() . '/' . $roa);
         if ($currs->length > 0) {
             $curr = $currs->item(0);
             if ($roa == 'and' || $roa == 'or') {
                 $p = new One_Permission_Rule_Joiner(array('type' => $roa, 'not' => $curr->getAttribute('not') == 'not' ? true : false));
                 $rules = $curr->getElementsByTagName('rule');
                 if ($rules->length > 0) {
                     for ($i = 0; $i < $rules->length; $i++) {
                         $rule = $rules->item($i);
                         $p->addRule(new One_Permission_Rule(array('type' => $rule->getAttribute('type'), 'not' => $rule->getAttribute('not') == 'not' ? true : false)));
                     }
                     unset($rule);
                 }
                 if ($curr->getElementsByTagName('and')->length > 0 || $curr->getElementsByTagName('or')->length > 0) {
                     $p->addRule(self::parseCondition($curr, $scheme));
                 }
             } else {
                 if ($roa == 'rule') {
                     $p = new One_Permission_Rule(array('type' => $curr->getAttribute('type'), 'not' => $curr->getAttribute('not') == 'not' ? true : false));
                 }
             }
         }
     }
     if (!is_null($name)) {
         $tasks = explode(';', $name);
         foreach ($tasks as $task) {
             if (trim($task) != '') {
                 $scheme->addRule($task, $p);
             }
         }
     }
     return $p;
 }
开发者ID:pdelbar,项目名称:onethree,代码行数:45,代码来源:xml.php


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