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


PHP Xml::toString方法代码示例

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


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

示例1: testNamespacing

 /**
  * testNamespacing method
  *
  * @access public
  * @return void
  */
 function testNamespacing()
 {
     $node = new Xml('<xml></xml>');
     $node->addNamespace('cake', 'http://cakephp.org');
     $this->assertEqual($node->toString(), '<xml xmlns:cake="http://cakephp.org" />');
     $this->assertTrue($node->removeNamespace('cake'));
     $this->assertEqual($node->toString(), '<xml />');
     $node = new Xml('<xml xmlns:cake="http://cakephp.org" />');
     $this->assertTrue($node->removeNamespace('cake'));
     $this->assertEqual($node->toString(), '<xml />');
     $node->addNamespace('cake', 'http://cakephp.org');
     $this->assertEqual($node->toString(), '<xml xmlns:cake="http://cakephp.org" />');
 }
开发者ID:slywalker,项目名称:CakePHPWorkshopKansai,代码行数:19,代码来源:xml.test.php

示例2: generateXML

 /**
  * Generate a XML for request
  *
  * @param string $method Name of method
  * @param array $params List of methods
  * @return string XML of request
  * @access protected
  */
 function generateXML($method, $params = array())
 {
     $query = array('methodCall' => array('methodName' => $method, 'params' => array()));
     if (!empty($params)) {
         $query['methodCall']['params']['param'] = array();
         foreach ($params as $param) {
             $query['methodCall']['params']['param'][] = $this->_normalizeParam($param);
         }
     }
     $xml = new Xml($query, array('format' => 'tags', 'tags' => array('methodCall' => array('name' => 'methodCall'))));
     return $xml->toString(array('cdata' => false, 'header' => true));
 }
开发者ID:kaz29,项目名称:datasources,代码行数:20,代码来源:xmlrpc_source.php

示例3: testToStringSlugging

 function testToStringSlugging()
 {
     $array = array('Response' => array('OneKey' => 'foo', 'TwoKey' => array('bar', 'baz')));
     $xml = new Xml($array, array('format' => 'tags'));
     $result = $xml->toString(array('cdata' => false));
     $expected = '<response><one_key>foo</one_key><two_key>bar</two_key><two_key>baz</two_key></response>';
     $this->assertEqual($result, $expected);
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:8,代码来源:xml.test.php

示例4: serialize

 /**
  * Serializes a model resultset into XML
  *
  * @param  mixed  $data The content to be converted to XML
  * @param  array  $options The data formatting options.  For a list of valid options, see
  *                         XmlNode::__construct().
  * @return string A copy of $data in XML format
  * @see XmlNode
  */
 public function serialize($data, $options = array())
 {
     $options += array('attributes' => false, 'format' => 'attributes');
     $data = new Xml($data, $options);
     return $data->toString($options + array('header' => false));
 }
开发者ID:evrard,项目名称:cakephp2x,代码行数:15,代码来源:xml.php

示例5: index

 /**
  *flash控制器.
  *
  *@param $type
  *@param $type_id
  */
 public function index($type, $type_id = 0)
 {
     //$this->page_init();
     if ($type == 'P') {
         $flash_info = $this->Flash->find("type = '{$type}'");
     } else {
         $flash_info = $this->Flash->find("type = '{$type}' and type_id = {$type_id} ");
     }
     if (empty($flash_info)) {
         return;
     }
     $flash_info['Flash']['titlebgcolor'] = hexdec($flash_info['Flash']['titlebgcolor']);
     $flash_info['Flash']['titletextcolor'] = hexdec($flash_info['Flash']['titletextcolor']);
     $flash_info['Flash']['btntextcolor'] = hexdec($flash_info['Flash']['btntextcolor']);
     $flash_info['Flash']['btndefaultcolor'] = hexdec($flash_info['Flash']['btndefaultcolor']);
     $flash_info['Flash']['btnhovercolor'] = hexdec($flash_info['Flash']['btnhovercolor']);
     $flash_info['Flash']['btnfocuscolor'] = hexdec($flash_info['Flash']['btnfocuscolor']);
     $config['roundCorner'] = $flash_info['Flash']['roundcorner'];
     $config['autoPlayTime'] = $flash_info['Flash']['autoplaytime'];
     $config['isHeightQuality'] = $flash_info['Flash']['isheightquality'];
     //$config['normal'] = $flash_info['Flash']['normal'];
     $config['windowOpen'] = $flash_info['Flash']['windowopen'];
     $config['btnSetMargin'] = $flash_info['Flash']['btnsetmargin'];
     $config['btnDistance'] = $flash_info['Flash']['btndistance'];
     $config['titleBgColor'] = $flash_info['Flash']['titlebgcolor'];
     $config['titleTextColor'] = $flash_info['Flash']['titletextcolor'];
     $config['titleBgAlpha'] = $flash_info['Flash']['titlebgalpha'];
     $config['titleFont'] = $flash_info['Flash']['titlefont'];
     $config['titleMoveDuration'] = $flash_info['Flash']['titlemoveduration'];
     $config['btnAlpha'] = $flash_info['Flash']['btnalpha'];
     $config['btnTextColor'] = $flash_info['Flash']['btntextcolor'];
     $config['btnDefaultColor'] = $flash_info['Flash']['btndefaultcolor'];
     $config['btnHoverColor'] = $flash_info['Flash']['btnhovercolor'];
     $config['btnFocusColor'] = $flash_info['Flash']['btnfocuscolor'];
     $config['changImageMode'] = $flash_info['Flash']['changimagemode'];
     $config['isShowBtn'] = $flash_info['Flash']['isshowbtn'];
     $config['isShowTitle'] = $flash_info['Flash']['isshowtitle'];
     $config['scaleMode'] = $flash_info['Flash']['scalemode'];
     $config['transform'] = $flash_info['Flash']['transform'];
     $config['isShowAbout'] = $flash_info['Flash']['isshowabout'];
     if ($type == 'P') {
         $galleries = $this->ProductGallery->get_product_gallery($type_id);
         if (isset($galleries) && sizeof($galleries) > 0) {
             foreach ($galleries as $k => $v) {
                 $flash_info['FlashImage'][$k]['image'] = $this->url($v['ProductGallery']['img_detail'], false);
                 if (Configure::read('App.baseUrl')) {
                     $flash_info['FlashImage'][$k]['image'] = str_replace('index.php/', '', $flash_info['FlashImage'][$k]['image']);
                 }
                 $flash_info['FlashImage'][$k]['flash_id'] = 1;
                 $flash_info['FlashImage'][$k]['link'] = '#';
                 $flash_info['FlashImage'][$k]['title'] = '';
             }
         }
     } elseif ($flash_info['FlashImage']) {
         foreach ($flash_info['FlashImage'] as $k => $v) {
             $flash_info['FlashImage'][$k]['image'] = $this->url($v['image'], false);
             if (Configure::read('App.baseUrl')) {
                 $flash_info['FlashImage'][$k]['image'] = str_replace('index.php/', '', $flash_info['FlashImage'][$k]['image']);
             }
             if (isset($v['url']) && $v['url'] != '') {
                 $flash_info['FlashImage'][$k]['link'] = $this->url($v['url'], false);
                 unset($flash_info['FlashImage'][$k]['url']);
             } else {
                 $flash_info['FlashImage'][$k]['link'] = '#';
             }
         }
     }
     $channel = $flash_info['FlashImage'];
     // pr($channel);
     $flash = array('channel' => array('item' => $channel), 'config' => $config);
     $xml_array = array('data' => $flash);
     $xml = new Xml($xml_array, array('format' => 'tags'));
     //	  pr($xml_array);
     //	  pr($xml);
     $result = $xml->toString(array('cdata' => true));
     //	  pr($result);
     $this->set('result', $result);
     //	  pr($flash);
     Configure::write('debug', 0);
     $this->layoutPath = 'xml';
     $this->layout = 'default';
 }
开发者ID:hobbysh,项目名称:seevia-opensource,代码行数:88,代码来源:flashes_controller.php

示例6: testEscapeCharSerialization

 /**
  * testEscapeCharSerialization method
  *
  * @access public
  * @return void
  */
 function testEscapeCharSerialization()
 {
     $xml = new Xml(array('text' => 'JavaScript & DHTML'), array('attributes' => false, 'format' => 'attributes'));
     $result = $xml->toString(false);
     $expected = '<std_class text="JavaScript &amp; DHTML" />';
     $this->assertEqual($expected, $result);
 }
开发者ID:laiello,项目名称:fredistrano,代码行数:13,代码来源:xml.test.php


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