当前位置: 首页>>代码示例>>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;未经允许,请勿转载。