CodeIgniter Forums
Parsing XML in CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Parsing XML in CI (/showthread.php?tid=23205)

Pages: 1 2


Parsing XML in CI - El Forum - 10-03-2009

[eluser]aryan_[/eluser]
Does Codeigniter has xml parser? I want to parse xml file and show its data.


Parsing XML in CI - El Forum - 10-03-2009

[eluser]skunkbad[/eluser]
I think using the built in SimpleXML class is very easy.

www.php.net/simplexml

It parses XML very nicely.


Parsing XML in CI - El Forum - 10-03-2009

[eluser]imn.codeartist[/eluser]
yes, you can create your own library using simpleXML


Parsing XML in CI - El Forum - 10-04-2009

[eluser]aryan_[/eluser]
I did this.

Why don't CI has inbuilt XML parsing class?


Parsing XML in CI - El Forum - 10-04-2009

[eluser]kyleect[/eluser]
Might as well use this thread for my question. Does anyone know of a way to convert a simplexml object to an array? Or, it easier, does anyone know of an alternate way to parse XML to an array in PHP? Thanks!


Parsing XML in CI - El Forum - 10-04-2009

[eluser]skunkbad[/eluser]
[quote author="aryan_" date="1254672713"]I did this.

Why don't CI has inbuilt XML parsing class?[/quote]

Probably because php has one that works great, and in my opinion doesn't need to be changed. My car tires are already round. You get me?


Parsing XML in CI - El Forum - 10-04-2009

[eluser]pistolPete[/eluser]
@kyleect:
Why do you need an array? Why would you prefer an array to an object?


Parsing XML in CI - El Forum - 10-04-2009

[eluser]skunkbad[/eluser]
Ya know, I guess I hadn't really thought about the CI users who do not have php5. SimpleXML is a php5 class, so perhaps CI users should create a class/library that parses XML like SimpleXML, but for php4. I have used a class like this in the past. I found it online, and probably have it somewhere in my mega script library. If I can find it, I will post it.


Parsing XML in CI - El Forum - 10-04-2009

[eluser]InsiteFX[/eluser]
Here you go skunkbad, is the one your talking about?

XML PHP4

Enjoy
InsiteFX


Parsing XML in CI - El Forum - 10-04-2009

[eluser]skunkbad[/eluser]
[quote author="InsiteFX" date="1254710349"]Here you go skunkbad, is the one your talking about?

XML PHP4

Enjoy
InsiteFX[/quote]

Ah yes! Thank you for finding my post! Yes, this class does allow for parsing XML in php4, very similar to php5 SimpleXML usage.