當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLElement::getName方法代碼示例

本文整理匯總了PHP中XMLElement::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLElement::getName方法的具體用法?PHP XMLElement::getName怎麽用?PHP XMLElement::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLElement的用法示例。


在下文中一共展示了XMLElement::getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fromXML

 /**
  * Instantiates Services_Gnip_Publisher with current class data values
  *
  * @access    public
  * @param     XMLElement               $xml      XML Publisher
  * @return    Services_Gnip_Publisher            Services_Gnip_Publisher object
  */
 function fromXML($xml)
 {
     if ($xml->getName() != "publisher") {
         throw new Exception("expected publisher");
     }
     return new Services_Gnip_Publisher($xml["name"]);
 }
開發者ID:nsimon,項目名稱:gnip-php,代碼行數:14,代碼來源:Publisher.php

示例2: FactoryFromXMLElement

 public static function FactoryFromXMLElement(XMLElement $element)
 {
     if ($element->getName() == 'CommonPrefixes') {
         return self::FactoryFromCommonPrefixes($element);
     }
     if ($element->getName() == 'Contents') {
         return self::FactoryFromContents($element);
     }
 }
開發者ID:nlevee,項目名稱:php-libs,代碼行數:9,代碼來源:Model_Item.php

示例3: addElementToHead

 /**
  * Adds an XMLElement to the `$this->_head` array at a desired position.
  * If no position is given, the object will be added to the end
  * of the `$this->_head` array. If that position is already taken, it will
  * add the object at the next available position.
  *
  * @see toolkit.General#array_find_available_index()
  * @param XMLElement $object
  * @param integer $position
  *  Defaults to null which will put the `$object` at the end of the
  *  `$this->_head`.
  * @param boolean $allowDuplicate
  *  If set to false, make this function check if there is already an XMLElement that as the same name in the head.
  *  Defaults to true. @since Symphony 2.3.2
  * @return integer
  *  Returns the position that the `$object` has been set in the `$this->_head`
  */
 public function addElementToHead(XMLElement $object, $position = null, $allowDuplicate = true)
 {
     // find the right position
     if ($position && isset($this->_head[$position])) {
         $position = General::array_find_available_index($this->_head, $position);
     } elseif (is_null($position)) {
         if (count($this->_head) > 0) {
             $position = max(array_keys($this->_head)) + 1;
         } else {
             $position = 0;
         }
     }
     // check if we allow duplicate
     if (!$allowDuplicate && !empty($this->_head)) {
         $this->removeFromHead($object->getName());
     }
     // append new element
     $this->_head[$position] = $object;
     return $position;
 }
開發者ID:jurajkapsz,項目名稱:symphony-2,代碼行數:37,代碼來源:class.htmlpage.php

示例4: getChildrenWithClass

 private function getChildrenWithClass(XMLElement &$rootElement, $className, $tagName = null)
 {
     if ($rootElement == null) {
         return null;
     }
     // contains the right css class and the right node name (if any)
     // TODO: Use word bondaries instead of strpos
     if ((!$className || strpos($rootElement->getAttribute('class'), $className) > -1) && (!$tagName || $rootElement->getName() == $tagName)) {
         return $rootElement;
     }
     // recursive search in child elements
     foreach ($rootElement->getChildren() as $key => $child) {
         if (!$child instanceof XMLElement) {
             continue;
         }
         $res = $this->getChildrenWithClass($child, $className, $tagName);
         if ($res != null) {
             return $res;
         }
     }
     return null;
 }
開發者ID:hotdoy,項目名稱:EDclock,代碼行數:22,代碼來源:field.image_upload.php


注:本文中的XMLElement::getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。