Home >Backend Development >PHP Tutorial >Codeigniter's method of converting xml into objects through SimpleXML_PHP tutorial

Codeigniter's method of converting xml into objects through SimpleXML_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:23783browse

Codeigniter's method of converting xml into objects through SimpleXML

This article mainly introduces Codeigniter's method of converting xml into objects through SimpleXML, and involves Codeigniter's skills in operating XML files. It is of great practical value, friends in need can refer to it

The example in this article describes how Codeigniter converts xml into objects through SimpleXML. Share it with everyone for your reference. The specific analysis is as follows:

SimpleXML is a php extension, with which you can operate xml files very easily

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

class CI_ManipulateXML

{

var $xml='';

function CI_ManipulateXML($xmlcontent)

{

$this->xml=$xmlcontent;

}

function ConvertXML() {

try {

$xmlobject = new SimpleXMLElement($this->xml);

if ($xmlobject == false) {

return false;

}

}

catch (Exception $e) {

return false;

}

return $xmlobject;

}

}

1 2

3

4 5

67 8 9 10 11 12
13
14
15 16 17 18 19 20
class CI_ManipulateXML { var $xml=''; function CI_ManipulateXML($xmlcontent) { $this->xml=$xmlcontent; } function ConvertXML() { try { $xmlobject = new SimpleXMLElement($this->xml); if ($xmlobject == false) { return false; } } catch (Exception $e) { return false; } return $xmlobject; } }
I hope this article will be helpful to everyone’s PHP programming based on the Codeigniter framework. http://www.bkjia.com/PHPjc/970751.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970751.htmlTechArticleCodeigniter converts xml into objects through SimpleXML. This article mainly introduces how Codeigniter converts xml into objects through SimpleXML. The method involves Codeigniter's techniques for operating XML files...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn