Esempio n. 1
0
 /**
  * Identify node path based on parent path and node attributes
  *
  * @param \DOMElement $node
  * @param string $parentPath
  * @return string
  */
 protected function _getNodePathByParent(\DOMElement $node, $parentPath)
 {
     $prefix = is_null($this->_rootNamespace) ? '' : self::ROOT_NAMESPACE_PREFIX . ':';
     $path = $parentPath . '/' . $prefix . $node->tagName;
     $idAttribute = $this->_nodeMergingConfig->getIdAttribute($path);
     if ($idAttribute && ($value = $node->getAttribute($idAttribute))) {
         $path .= "[@{$idAttribute}='{$value}']";
     }
     return $path;
 }
Esempio n. 2
0
 /**
  * Identify node path based on parent path and node attributes
  *
  * @param \DOMElement $node
  * @param string $parentPath
  * @return string
  */
 protected function _getNodePathByParent(\DOMElement $node, $parentPath)
 {
     $prefix = is_null($this->_rootNamespace) ? '' : self::ROOT_NAMESPACE_PREFIX . ':';
     $path = $parentPath . '/' . $prefix . $node->tagName;
     $idAttribute = $this->_nodeMergingConfig->getIdAttribute($path);
     if (is_array($idAttribute)) {
         $constraints = [];
         foreach ($idAttribute as $attribute) {
             $value = $node->getAttribute($attribute);
             $constraints[] = "@{$attribute}='{$value}'";
         }
         $path .= '[' . join(' and ', $constraints) . ']';
     } elseif ($idAttribute && ($value = $node->getAttribute($idAttribute))) {
         $path .= "[@{$idAttribute}='{$value}']";
     }
     return $path;
 }