![]() |
Parsing XML File Problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Parsing XML File Problem (/showthread.php?tid=56528) |
Parsing XML File Problem - El Forum - 12-28-2012 [eluser]ahmadalyan[/eluser] hi all I have XML file Code: <?xml version="1.0" encoding="utf-8" ?> i want to read this like Code: $project_term= $date['projectTerm']; any one can help Parsing XML File Problem - El Forum - 12-28-2012 [eluser]pickupman[/eluser] You should be able to read the string using [url="http://us2.php.net/manual/en/function.simplexml-load-string.php"]simplexml_load_string[/url]. Each node will be part of the object as you had shown instead of an array. Code: $xml = '<?xml version="1.0" encoding="utf-8" ?> Parsing XML File Problem - El Forum - 12-28-2012 [eluser]ahmadalyan[/eluser] Dear pickupman it's doesn't work when i try your solution and Code: $xml = '<?xml version="1.0" encoding="utf-8" ?> i had this output Code: ( [item] => Array ( [0] => Project Term [1] => Project Term Text [2] => Langauge so i can reach the item using Code: $XMLdata->item[0]; // the output will be Project Term but i don't want to use the index 0,1,2 ... i want to use the name attribute to catch the key Parsing XML File Problem - El Forum - 12-28-2012 [eluser]ahmadalyan[/eluser] i solved the problem Code: $this->lang->load('welcome'); |