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


PHP SimpleXMLIterator::getName方法代码示例

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


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

示例1: unserialize

 /**
  * 
  * @return Zend_Tool_Project_Structure_Graph
  */
 public function unserialize($data)
 {
     if ($data == null) {
         throw new Exception('contents not available to unserialize.');
     }
     $xmlDataIterator = new SimpleXMLIterator($data);
     if ($xmlDataIterator->getName() != 'projectProfile') {
         throw new Exception('Profiles must start with a projectProfile node');
     }
     $this->_graph = new Zend_Tool_Project_Structure_Graph();
     $this->_unserializeRecurser($xmlDataIterator);
     return $this->_graph;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:17,代码来源:Xml.php

示例2: unserialize

 /**
  * unserialize()
  *
  * Create a structure in the object $profile from the structure specficied
  * in the xml string provided
  *
  * @param string xml data
  * @param Zend_Tool_Project_Profile The profile to use as the top node
  * @return Zend_Tool_Project_Profile
  */
 public function unserialize($data, Zend_Tool_Project_Profile $profile)
 {
     if ($data == null) {
         throw new Exception('contents not available to unserialize.');
     }
     $this->_profile = $profile;
     $xmlDataIterator = new SimpleXMLIterator($data);
     if ($xmlDataIterator->getName() != 'extensionProfile') {
         throw new Exception('Extension profile must start with a extensionProfile node');
     }
     if (isset($xmlDataIterator['type'])) {
         $this->_profile->setAttribute('type', (string) $xmlDataIterator['type']);
     }
     if (isset($xmlDataIterator['version'])) {
         $this->_profile->setAttribute('version', (string) $xmlDataIterator['version']);
     }
     // start un-serialization of the xml doc
     $this->_unserializeRecurser($xmlDataIterator);
     // contexts should be initialized after the unwinding of the profile structure
     $this->_lazyLoadContexts();
     return $this->_profile;
 }
开发者ID:CEMD-CN,项目名称:MageTool,代码行数:32,代码来源:Xml.php

示例3: unserialize

 /**
  * unserialize()
  *
  * Create a structure in the object $profile from the structure specficied
  * in the xml string provided
  *
  * @param string xml data
  * @param Zend_Tool_Project_Profile The profile to use as the top node
  * @return Zend_Tool_Project_Profile
  */
 public function unserialize($data, Zend_Tool_Project_Profile $profile)
 {
     if ($data == null) {
         throw new Exception('contents not available to unserialize.');
     }
     $this->_profile = $profile;
     $xmlDataIterator = new SimpleXMLIterator($data);
     if ($xmlDataIterator->getName() != 'projectProfile') {
         throw new Exception('Profiles must start with a projectProfile node');
     }
     $this->_unserializeRecurser($xmlDataIterator);
     $this->_lazyLoadContexts();
     return $this->_profile;
 }
开发者ID:c12g,项目名称:stratos-php,代码行数:24,代码来源:Xml.php

示例4: _unserializeXml

 protected function _unserializeXml($xmlProjectProfile)
 {
     if ($xmlProjectProfile == null) {
         throw new Exception('contents not available to unserialize.');
     }
     $projectProfileIterator = new SimpleXMLIterator($xmlProjectProfile);
     if ($projectProfileIterator->getName() != 'projectProfile') {
         throw new Exception('Profiles must start with a projectProfile node');
     }
     $this->_unserializeRecurser($projectProfileIterator);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:11,代码来源:ProjectProfile.php

示例5: SimpleXMLIterator

<pre>
<?php 
$xml = <<<XML
<books>
    <book>
        <title>PHP Basics</title>
        <author>Jim Smith</author>
    </book>
    <book>XML basics</book>
</books>
XML;
$xmlIterator = new SimpleXMLIterator($xml);
//books
for ($xmlIterator->rewind(); $xmlIterator->valid(); $xmlIterator->next()) {
    foreach ($xmlIterator->getChildren() as $name => $data) {
        echo "The {$name} is '{$data}' from the class " . get_class($data) . "\n";
    }
    echo $xmlIterator->getName() . "\n";
    //2 times of books will be print out
}
?>
</pre>
开发者ID:pixlr,项目名称:zce-1,代码行数:22,代码来源:getChildren.php

示例6: updateAPP

 protected function updateAPP()
 {
     if (is_file($this->applist) && is_writable($this->applist)) {
         try {
             $doc = new SimpleXMLIterator($this->applist, null, true);
         } catch (Exception $e) {
             $this->error[] = "发生异常:" . $e->getMessage() . "  文件:" . $e->getFile() . "  行号:" . $e->getLine();
             return false;
         }
         if ($doc->getName() != "apps") {
             $this->error[] = "applist.xml的根元素必须是apps";
             return false;
         }
         $i = $doc->count();
         if ($i !== 0) {
             $apps = $doc->app;
             foreach ($apps as $app) {
                 if ($app['name'] == $this->app_name) {
                     $this->error[] = "项目列表存在重名项目,请修改项目名称";
                     return false;
                 }
             }
         }
         $doc->addChild("app");
         $doc->app[$i]->addAttribute("name", $this->app_name);
         $doc->app[$i]->addAttribute("path", $this->app_path);
         $doc->app[$i]->addAttribute("index", $this->app_index);
         if ($doc->asXML($this->applist)) {
             return true;
         } else {
             $this->error[] = "TinkPHP助手/data/applist.xml 写入失败";
             return false;
         }
     } else {
         $this->error[] = "TinkPHP助手/data/applist.xml不存在";
         return false;
     }
 }
开发者ID:sdgdsffdsfff,项目名称:TPhelper,代码行数:38,代码来源:AdminAction.class.php

示例7: arrayFromXml

    /**
     * Create an Array from XML
     *
     * This method sets up the SimpleXMLIterator and starts the parsing
     * of an xml body to iterate through it and transform it into
     * an array that can be used by the developers.
     *
     * @param string $xml
     * @return array An array mapped to the passed xml
     */
    public static function arrayFromXml($xml)
    {
        // replace namespace defs
        $xml = str_replace('xmlns=', 'ns=', $xml);

        // catch libxml errors
        libxml_use_internal_errors(true);
        try {
            $iterator = new SimpleXMLIterator($xml);
        } catch(Exception $e) {
            $xmlErrors = libxml_get_errors();
             return new Frapi_Exception(
                     'Xml Parsing Failed', 
                     'INVALID_XML', 
                     400, 
                     'xml_parsing'
                     );
             libxml_clear_errors();
        }
        
        $xmlRoot = $iterator->getName();
        $type = $iterator->attributes()->type;

        // SimpleXML provides the root information on construct
        self::$_xmlRoot = $iterator->getName();
        self::$_responseType = $type;
        
        // return the mapped array with the root element as the header
        return array($xmlRoot => self::_iteratorToArray($iterator));
    }
开发者ID:reith2004,项目名称:frapi,代码行数:40,代码来源:XmlParser.php

示例8: arrayFromXml

 /**
  * sets up the SimpleXMLIterator and starts the parsing
  * @access public
  * @param string $xml
  * @return array array mapped to the passed xml
  */
 public static function arrayFromXml($xml)
 {
     // SimpleXML provides the root information on construct
     $iterator = new SimpleXMLIterator($xml);
     $xmlRoot = Braintree_Util::delimiterToCamelCase($iterator->getName());
     $type = $iterator->attributes()->type;
     self::$_xmlRoot = $iterator->getName();
     self::$_responseType = $type;
     // return the mapped array with the root element as the header
     return array($xmlRoot => self::_iteratorToArray($iterator));
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:17,代码来源:Parser.php


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