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


PHP Tree::fromString方法代码示例

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


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

示例1: fromString

 /**
  * Construct a XML-RPC message from a string
  *
  * <code>
  *   $msg= XmlRpcRequestMessage::fromString('<methodCall>...</methodCall>');
  * </code>
  *
  * @param   string string
  * @return  webservices.xmlrpc.XmlRpcMessage
  */
 public static function fromString($string)
 {
     $msg = new XmlRpcRequestMessage();
     $msg->tree = Tree::fromString($string);
     // Set class and method members from XML structure
     $target = $msg->tree->root()->nodeAt(0)->getContent();
     list($msg->class, $msg->method) = explode('.', $target);
     return $msg;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:19,代码来源:XmlRpcRequestMessage.class.php

示例2: fromString

 /**
  * Construct a XML-RPC response message from a string
  *
  * <code>
  *   $msg= XmlRpcResponseMessage::fromString('<methodCall>...</methodCall>');
  * </code>
  *
  * @param   string string
  * @return  webservices.xmlrpc.XmlRpcResponse Message
  */
 public static function fromString($string)
 {
     $msg = new self();
     $msg->tree = Tree::fromString($string);
     if (!$msg->tree->root()->hasChildren()) {
         throw new FormatException('Response is not well formed');
     }
     // Set class and method members from XML structure
     $target = $msg->tree->root()->nodeAt(0)->getContent();
     @(list($msg->class, $msg->method) = explode('.', $target));
     return $msg;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:22,代码来源:XmlRpcResponseMessage.class.php

示例3: runTests

 /**
  * Run tests and return XML generated
  *
  * @param   unittest.TestCase... tests
  * @return  xml.Tree the output
  * @throws  unittest.AssertionFailedError in case the generated XML is not well-formed
  */
 protected function runTests()
 {
     foreach (func_get_args() as $test) {
         $this->suite->addTest($test);
     }
     $this->suite->run();
     try {
         return Tree::fromString($this->out->getBytes());
     } catch (XMLFormatException $e) {
         $this->fail('XML generated is not well-formed: ' . $e->getMessage(), $this->out->getBytes(), NULL);
     }
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:19,代码来源:XmlListenerTest.class.php

示例4: decode

 /**
  * Decode xml
  *
  * @param   string xml
  * @return  mixed
  */
 protected function decode($xml)
 {
     return create(new XmlRpcDecoder())->decode(Tree::fromString('<?xml version="1.0" encoding="utf-8"?><value>' . $xml . '</value>')->root());
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:10,代码来源:XmlRpcDecoderTest.class.php

示例5: fromString

 /**
  * Create a RDF from a string
  *
  * @param   string str
  * @return  xml.rdf.RDFNewsfeed
  */
 public static function fromString($str, $c = __CLASS__)
 {
     return parent::fromString($str, $c);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:10,代码来源:RDFNewsFeed.class.php

示例6: fromString

 /**
  * Create a new JNLP document from a string
  *
  * @param   string str
  * @return  &com.sun.webstart.JnlpDocument
  */
 public static function fromString($str)
 {
     if ($j = parent::fromString($str, __CLASS__)) {
         $j->extract();
     }
     return $j;
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:13,代码来源:JnlpDocument.class.php

示例7: setData

 /**
  * Set request's data and try to parse the request body (if available)
  *
  * @param  string data The request's data
  */
 public function setData($data)
 {
     parent::setData($data);
     try {
         $this->tree = Tree::fromString($data);
     } catch (Exception $e) {
         // Catch exception which occur when request body contains binary
         // data (e.g. when PUTting files)
     }
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:15,代码来源:WebdavScriptletRequest.class.php

示例8: fromString

 /**
  * Create a WddxMessage object from an XML document.
  *
  * @param   string string
  * @return  webservices.wddx.WddxMessage
  */
 public static function fromString($string)
 {
     return parent::fromString($string, 'WddxMessage');
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:10,代码来源:WddxMessage.class.php

示例9: queryTreeWithEncoding

 public function queryTreeWithEncoding()
 {
     $value = new String('value öäü', 'iso-8859-1');
     $xpath = new XPath(Tree::fromString(sprintf('<?xml version="1.0" encoding="iso-8859-1"?>' . '<document><node>%s</node></document>', $value->getBytes('iso-8859-1'))));
     $this->assertEquals($value, new String($xpath->query('string(/document/node)'), 'utf-8'));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:6,代码来源:XPathTest.class.php

示例10: fromNonXmlString

 public function fromNonXmlString()
 {
     Tree::fromString('@@NO-XML-HERE@@');
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:4,代码来源:TreeTest.class.php

示例11: fromString

 /**
  * Construct a document from a string
  *
  * @param   string string
  * @return  xml.dom.Document
  */
 public static function fromString($string, $class = __CLASS__)
 {
     return parent::fromString($string, $class);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:10,代码来源:Document.class.php

示例12: unserialize

 /**
  * Unserializes xml data
  *
  * @param   string xml
  * @return  mixed
  */
 public function unserialize($xml)
 {
     $tree = Tree::fromString('<?xml version="1.0" encoding="utf-8"?><data>' . $xml . '</data>');
     return $this->_recurse($tree->root);
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:11,代码来源:FlickrClient.class.php


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