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


PHP DOMNode::getElementsByTagName方法代码示例

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


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

示例1: __collectGroup

 protected function __collectGroup(DOMDocument $v9a09b4dfda82e3e665e31092d1c3ec8d, DOMNode $v1471e4e05a4db95d353cc867fe317314, DOMNode $vdb0f6f37ebeb6ea09489124345af2a45)
 {
     $v3d788fa62d7c185a1bee4c9147ee1091 = new DOMXPath($v9a09b4dfda82e3e665e31092d1c3ec8d);
     $vb8d7f0a7b1f89a0e2689069b9ead837d = $vdb0f6f37ebeb6ea09489124345af2a45->getElementsByTagName("Ид");
     $v00655e48bd78b9fefe2ba39b753dd932 = $vdb0f6f37ebeb6ea09489124345af2a45->getElementsByTagName("Наименование");
     $vb80bb7740288fda1f201890375a60c8f = $vb8d7f0a7b1f89a0e2689069b9ead837d->item(0)->nodeValue;
     $vb068931cc450442b63f5b3d276ea4297 = $v00655e48bd78b9fefe2ba39b753dd932->item(0)->nodeValue;
     $vc772070e479ef7642e1f6b1620b703ab = $v3d788fa62d7c185a1bee4c9147ee1091->evaluate(".//Группа[Ид='{$vb80bb7740288fda1f201890375a60c8f}']", $v1471e4e05a4db95d353cc867fe317314);
     if ($vc772070e479ef7642e1f6b1620b703ab instanceof DOMNodeList && $vc772070e479ef7642e1f6b1620b703ab->length) {
         return $vc772070e479ef7642e1f6b1620b703ab->item(0);
     }
     $v1722ade329f7d0765de2a5d5cf04b3e6 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createElement('Группа');
     $v1722ade329f7d0765de2a5d5cf04b3e6->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createElement('Ид', $vb80bb7740288fda1f201890375a60c8f));
     $v1722ade329f7d0765de2a5d5cf04b3e6->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createElement('Наименование', $vb068931cc450442b63f5b3d276ea4297));
     $vd0e45878043844ffc41aac437e86b602 = $vdb0f6f37ebeb6ea09489124345af2a45->parentNode ? $vdb0f6f37ebeb6ea09489124345af2a45->parentNode->parentNode : false;
     if ($vd0e45878043844ffc41aac437e86b602 && $vd0e45878043844ffc41aac437e86b602->nodeName == "Группа") {
         $v8040a7de679c140285d7b0ca689dadc5 = $this->__collectGroup($v9a09b4dfda82e3e665e31092d1c3ec8d, $v1471e4e05a4db95d353cc867fe317314, $vd0e45878043844ffc41aac437e86b602);
         $vecc14ae322be7f2622dee4a101209ee9 = $v8040a7de679c140285d7b0ca689dadc5->childNodes->item(2);
         if (!$vecc14ae322be7f2622dee4a101209ee9) {
             $vecc14ae322be7f2622dee4a101209ee9 = $v8040a7de679c140285d7b0ca689dadc5->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createElement("Группы"));
         }
         $vecc14ae322be7f2622dee4a101209ee9->appendChild($v1722ade329f7d0765de2a5d5cf04b3e6);
     } else {
         $v1471e4e05a4db95d353cc867fe317314->appendChild($v1722ade329f7d0765de2a5d5cf04b3e6);
     }
     return $v1722ade329f7d0765de2a5d5cf04b3e6;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:27,代码来源:commerceML2Splitter.php

示例2: getChNFe

 /**
  * Retorna a chave de 44 caracteres da nfe.
  *
  * @return string
  */
 public function getChNFe()
 {
     if ($this->isError()) {
         return '';
     }
     return $this->infProt->getElementsByTagName('chNFe')->item(0)->textContent;
 }
开发者ID:phpnfe,项目名称:nfe,代码行数:12,代码来源:AutorizaRetorno.php

示例3: loadFromXml

 protected function loadFromXml(DOMNode $elem)
 {
     $attr = $elem->attributes->getNamedItem('type');
     if ($attr != null) {
         $this->type = $attr->nodeValue;
     } else {
         $this->type = self::TYPE_PERSON;
     }
     $elems = $elem->getElementsByTagName('first_name');
     if ($elems->length == 1) {
         $this->firstName = urldecode($elems->item(0)->nodeValue);
     }
     $elems = $elem->getElementsByTagName('last_name');
     if ($elems->length == 1) {
         $this->lastName = urldecode($elems->item(0)->nodeValue);
     }
     $elems = $elem->getElementsByTagName('address');
     if ($elems->length == 1) {
         $this->address = urldecode($elems->item(0)->nodeValue);
     }
     $elems = $elem->getElementsByTagName('email');
     if ($elems->length == 1) {
         $this->email = urldecode($elems->item(0)->nodeValue);
     }
     $elems = $elem->getElementsByTagName('mobile_phone');
     if ($elems->length == 1) {
         $this->mobilePhone = urldecode($elems->item(0)->nodeValue);
     }
 }
开发者ID:alexandrei892,项目名称:mobilpay-card-gateway-for-woocommerce,代码行数:29,代码来源:class-mobilpay-address.php

示例4: createNode

function createNode(DOMDocument $targetdoc, DOMNode $targetnode, DOMNode $entry, $with_content = true)
{
    $a = $targetdoc->createElement('a');
    $targetnode->appendChild($a);
    $a->setAttribute('href', $entry->getElementsByTagName('id')->item(0)->nodeValue);
    $a->appendChild($targetdoc->createElement('b', date('Y-m-d H:i:s', strtotime($entry->getElementsByTagName('updated')->item(0)->nodeValue)) . ': '));
    $a->appendChild($targetdoc->createTextNode($entry->getElementsByTagName('title')->item(0)->nodeValue));
    if ($with_content && ($contents = $entry->getElementsByTagName('content')) && $contents->length) {
        $div = $targetdoc->createElement('div');
        $targetnode->appendChild($div);
        $div->appendChild($targetdoc->importNode($contents->item(0), true));
    }
}
开发者ID:johannes,项目名称:linkblog,代码行数:13,代码来源:helper.php

示例5: matchXmlStructure

 /**
  * @param $xml
  * @return bool
  */
 public function matchXmlStructure($xml)
 {
     $xml = XmlUtils::toXml($xml);
     $root = $xml->firstChild;
     $els = $this->xml->getElementsByTagName($root->nodeName);
     if (empty($els)) {
         throw new ElementNotFound($root->nodeName, 'Element');
     }
     $matches = false;
     foreach ($els as $node) {
         $matches |= $this->matchForNode($root, $node);
     }
     return $matches;
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:18,代码来源:XmlStructure.php

示例6: unserializeContentClassAttribute

 /**
  * Unserialize contentclass attribute
  *
  * @param eZContentClassAttribute $classAttribute
  * @param DOMNode $attributeNode
  * @param DOMNode $attributeParametersNode
  */
 function unserializeContentClassAttribute($classAttribute, $attributeNode, $attributeParametersNode)
 {
     $defaultZoneLayout = $attributeParametersNode->getElementsByTagName('default-layout')->item(0)->textContent;
     if ($defaultZoneLayout !== false) {
         $classAttribute->setAttribute(self::DEFAULT_ZONE_LAYOUT_FIELD, $defaultZoneLayout);
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:14,代码来源:ezpagetype.php

示例7: applyStyle

 /**
  * Apply style information to object
  * If object has no style information yet, then create new style node
  * If object style information is similar to other object's style info, then apply the same style name
  *     And if object old style information was not shared with other objects then delete old style info
  *     Else leave old style info
  * Else just add new style description
  *
  * @param string $style_name
  * @param string $name
  * @param mixed $value
  * @param OpenDocument_StyledElement $object
  * @return string $style_name
  */
 public function applyStyle($style_name, $name, $value, OpenDocument_StyledElement $object)
 {
     //check if other nodes have the same style name
     $nodes = $this->cursor->getElementsByTagName('*');
     $count = 0;
     foreach ($nodes as $node) {
         if ($node->hasAttributeNS(self::NS_TEXT, 'style-name') && $node->getAttributeNS(self::NS_TEXT, 'style-name') == $style_name) {
             $count++;
             if ($count > 1) {
                 break;
             }
         }
     }
     $generate = false;
     //get style node
     if ($count > 1) {
         $style = $this->getStyleNode($style_name)->cloneNode(true);
         $this->styles->appendChild($style);
         $generate = true;
         $style_name = uniqid('tmp');
         //$object->generateStyleName();
         $style->setAttributeNS(self::NS_STYLE, 'name', $style_name);
     } else {
         $style = $this->getStyleNode($style_name);
     }
     if (empty($style)) {
         if (empty($style_name)) {
             $generate = true;
             $style_name = uniqid('tmp');
         }
         $style = $this->contentDOM->createElementNS(self::NS_STYLE, 'style');
         $style->setAttributeNS(self::NS_STYLE, 'name', $style_name);
         $style->setAttributeNS(self::NS_STYLE, 'family', 'paragraph');
         $style->setAttributeNS(self::NS_STYLE, 'parent-style-name', 'Standard');
         $this->styles->appendChild($style);
     }
     $nodes = $style->getElementsByTagNameNS(self::NS_STYLE, 'text-properties');
     if ($nodes->length) {
         $text_properties = $nodes->item(0);
     } else {
         $text_properties = $this->contentDOM->createElementNS(self::NS_STYLE, 'text-properties');
         $style->appendChild($text_properties);
     }
     $text_properties->setAttribute($name, $value);
     //find alike style
     $nodes = $this->styles->getElementsByTagNameNS(self::NS_STYLE, 'style');
     foreach ($nodes as $node) {
         if (!$style->isSameNode($node) && $this->compareChildNodes($style, $node)) {
             $style->parentNode->removeChild($style);
             return $node->getAttributeNS(self::NS_STYLE, 'name');
         }
     }
     if ($generate) {
         $style_name = $object->generateStyleName();
         $style->setAttributeNS(self::NS_STYLE, 'name', $style_name);
     }
     return $style->getAttributeNS(self::NS_STYLE, 'name');
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:72,代码来源:OpenDocument.php

示例8: getFirstElementByTagName

 /**
  * Returns the first $subnode occurence of a $node.
  * The subnode is identified by its name.
  *
  * @param DOMNode $node
  * @param string $subnode_name
  * @return DOMNode
  */
 public static function getFirstElementByTagName($node, $subnode_name)
 {
     $nodes = $node->getElementsByTagName($subnode_name);
     if ($nodes->length > 0) {
         return $nodes->item(0);
     } else {
         return null;
     }
 }
开发者ID:alaxos,项目名称:cakephp3-libs,代码行数:17,代码来源:XmlTool.php

示例9: getNodesName

 /**
  * Return array of descendant DOMNode of $node with tagName equals to $name
  *
  * @param DOMNode $node to starts with
  * @param string  $name of descendant
  *
  * @return array of descendant DOMNode with tagName equals to $name
  */
 public static function getNodesName($node, $name)
 {
     if (strpos($name, ':') !== false) {
         list(, $localname) = explode(':', $name);
         $nodes = $node->getElementsByTagNameNS('*', $localname);
     } else {
         $nodes = $node->getElementsByTagName($name);
     }
     return self::filterNodeListByName($nodes, $name);
 }
开发者ID:inscriptionweb,项目名称:kriss_feed,代码行数:18,代码来源:Rss.php

示例10: getPropertyFromNode

 /**
  * Get property from nide
  *
  * @param DOMNode $node Node
  * @param String $tagName tag name
  * @param Boolean $nullable property can be null
  *
  * @return String description
  *
  */
 public static function getPropertyFromNode(\DOMNode $node, $tagName, $nullable = true)
 {
     $elements = $node->getElementsByTagName($tagName);
     if ($elements->length == 0) {
         if (!$nullable) {
             throw new MetadataException(sprintf('%s : hydratation error with "%s" node.', get_called_class(), $tagName));
         }
         return null;
     }
     $value = $elements->item(0)->nodeValue;
     return $value == 'false' ? false : $value;
 }
开发者ID:fortuneteller,项目名称:phpOlap,代码行数:22,代码来源:MetadataBase.php

示例11: __construct

 /**
  * Create a MARC Data Field
  * 
  * @param \DOMNode $objNode
  */
 public function __construct(\DOMNode $objNode = null)
 {
     if ($objNode != null) {
         $this->tag = $objNode->getAttribute("tag");
         $this->ind1 = $objNode->getAttribute("ind1");
         $this->ind2 = $objNode->getAttribute("ind2");
         foreach ($objNode->getElementsByTagName("subfield") as $objSubfield) {
             $objMarcSubField = new SubField($objSubfield);
             array_push($this->_subfields, $objMarcSubField);
         }
     }
 }
开发者ID:fresnostate-library,项目名称:xerxes,代码行数:17,代码来源:DataField.php

示例12: loadFromXml

 protected function loadFromXml(DOMNode $elem)
 {
     $attr = $elem->attributes->getNamedItem('currency');
     if ($attr == null) {
         throw new Exception('Mobilpay_Payment_Invoice::loadFromXml failed; currency attribute missing', self::ERROR_LOAD_FROM_XML_CURRENCY_ATTR_MISSING);
     }
     $this->currency = $attr->nodeValue;
     $attr = $elem->attributes->getNamedItem('amount');
     if ($attr != null) {
         $this->amount = $attr->nodeValue;
     }
     $attr = $elem->attributes->getNamedItem('installments');
     if ($attr != null) {
         $this->installments = $attr->nodeValue;
     }
     $attr = $elem->attributes->getNamedItem('selected_installments');
     if ($attr != null) {
         $this->selectedInstallments = $attr->nodeValue;
     }
     $elems = $elem->getElementsByTagName('details');
     if ($elems->length == 1) {
         $this->details = urldecode($elems->item(0)->nodeValue);
     }
     $elems = $elem->getElementsByTagName('contact_info');
     if ($elems->length == 1) {
         $addrElem = $elems->item(0);
         $elems = $addrElem->getElementsByTagName('billing');
         if ($elems->length == 1) {
             $this->billingAddress = new Mobilpay_Payment_Address($elems->item(0));
         }
         $elems = $addrElem->getElementsByTagName('shipping');
         if ($elems->length == 1) {
             $this->shippingAddress = new Mobilpay_Payment_Address($elems->item(0));
         }
     }
 }
开发者ID:grchis,项目名称:Site-Auto,代码行数:36,代码来源:invoice.php

示例13: parseTable

 /**
  * @param DOMElement|DOMNode $table
  * @param array $range
  * @return array
  */
 protected function parseTable($table, $range = null)
 {
     $array = array();
     foreach ($table->getElementsByTagName('tr') as $row => $tr) {
         if ($range) {
             foreach ($range as $i) {
                 $array[$row][] = $tr->getElementsByTagName('td')->item($i)->textContent;
             }
         } else {
             foreach ($tr->getElementsByTagName('td') as $td) {
                 $array[$row][] = $td->textContent;
             }
         }
     }
     return $array;
 }
开发者ID:xshwz,项目名称:kingo,代码行数:21,代码来源:Functions.php

示例14: configure

 public function configure($parent, $configContext, DOMNode $documentElement)
 {
     $this->setORBConfig($configContext);
     $section = $documentElement->getElementsByTagName("services")->item(0);
     // check required !
     $this->m_configNode = $section;
     foreach ($section->childNodes as $element) {
         if (!$element instanceof DOMElement) {
             continue;
         }
         $nameElements = $element->getElementsByTagName("name");
         $serviceName = trim($nameElements->item(0)->nodeValue);
         $idElements = $element->getElementsByTagName("serviceId");
         $serviceId = trim($idElements->item(0)->nodeValue);
         ORBConfig::getInstance()->getServiceRegistry()->_addMapping($serviceName, $serviceId, array());
     }
 }
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:17,代码来源:ServicesConfigHandler.php

示例15: getItem

function getItem(\DOMNode $itemDomNode)
{
    $item = new \stdClass();
    $item->title = $itemDomNode->getElementsByTagName('title')->item(0)->firstChild->data;
    $item->link = $itemDomNode->getElementsByTagName('link')->item(0)->firstChild->data;
    $item->description = $itemDomNode->getElementsByTagName('description')->item(0)->firstChild->data;
    $authorText = $itemDomNode->getElementsByTagName('author')->item(0)->firstChild->data;
    $arr = explode(' ', trim($authorText));
    $item->authorEmail = trim($arr[0]);
    $item->guid = $itemDomNode->getElementsByTagName('guid')->item(0)->firstChild->data;
    $item->pubDate = $itemDomNode->getElementsByTagName('pubDate')->item(0)->firstChild->data;
    $item->viaUrl = $itemDomNode->getElementsByTagNameNS('http://www.editoreye.com/rss/via', 'link')->item(0)->getAttribute('url');
    $item->via = $itemDomNode->getElementsByTagNameNS('http://www.editoreye.com/rss/via', 'link')->item(0)->getAttribute('name');
    $item->authorName = $itemDomNode->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', 'creator')->item(0)->firstChild->data;
    $item->content = $itemDomNode->getElementsByTagName('content')->item(0)->firstChild->data;
    return $item;
}
开发者ID:stuartwilsondev,项目名称:ee-wp-rss-consumer,代码行数:17,代码来源:rss-consumer.php


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