View Full Version : replacing simplexml function

08-09-2008, 02:26 AM
I need to replace simplexml_load_file() as I don't have the latest PHP installation on my host sao does anyone have a suggerstion?

08-09-2008, 04:21 AM
Get a new host. SimpleXML is enabled by default on PHP5.. you have to specifically disable it if you don't want to use it, and there should be no serious reason you would need to disable it.

Alternatively, you can try some of the other XML extensions (http://php.net/refs.xml) available with PHP, or look for one that suits your needs in the PEAR repository (http://pear.php.net/search.php?q=xml&in=packages).

08-09-2008, 05:48 AM
The best part about XML is its required well-formed nature. Worst comes to worst, you can create you're own XML handling. I have done this once on PHP4, but as soon as I could use (I think it was) the DOMXML library I dumped the ones I created. Why reinvent the wheel.
I don't have this code anymore, but I recall it being simple pattern matching. It did require a full load of the file so it wouldn't work if the file was too large to handle (at the time, about 64mb in size).
As Indegoesdr mentioned, there are a lot of XML handling functions in PHP.

If you're on PHP4, you'll be looking at DOMXML - you'll need the libxml library if I'm not mistaken to use it. If you're on PHP5, look into the DOM - simplexml can be converted to and from DOM if I'm not mistaken. DOM is also enabled by default in PHP5, but can also be disabled.

08-09-2008, 06:59 PM
There are also several third-party backports (http://www.google.com/search?hl=en&q=simplexml+for+php4&btnG=Google+Search).