Doubt on simplexml_load_file()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aananth_it
Forum Newbie
Posts: 3
Joined: Tue Jun 19, 2007 8:51 am

Doubt on simplexml_load_file()

Post by aananth_it »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hai,
     i am Ananth working as a PHP developer. Now i have a doubt on simplexml_load_file() function. this function is not working. My code is

Code: Select all

$myGroceryList = "groceries.xml" ; 

	if (file_exists('groceries.xml')) 
	{
		$xml = @simplexml_load_file('groceries.xml');
		print_r($xml);
	}
	else
	{
		exit('Failed to open groceries.xml.');
	}
In this above code with out this @ symbol before simplexml_load_file() function i will not loaded. It's give a error message like

Fatal error: Call to undefined function: simplexml_load_file() in c:\phpdev\www\ananth\19_06_07\list.php on line 8

Reply me please.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Version of PHP?
aananth_it
Forum Newbie
Posts: 3
Joined: Tue Jun 19, 2007 8:51 am

Version

Post by aananth_it »

PHP Version 4.2.3
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

SimpleXML is not in PHP 4.
aananth_it
Forum Newbie
Posts: 3
Joined: Tue Jun 19, 2007 8:51 am

Version

Post by aananth_it »

Then which version will support the function simplexml_load_file().
Then which function() will support in the PHP version 4.2.3 to load XML file
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

staar2
Forum Commoner
Posts: 83
Joined: Fri Apr 06, 2007 2:57 am

Post by staar2 »

Is better to use Dom xml or simple xml, wich one of them is better. I know that simple xml is lot of easier what about DOM XML ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It all comes down to which one is available given your installation.
staar2
Forum Commoner
Posts: 83
Joined: Fri Apr 06, 2007 2:57 am

Post by staar2 »

But DOM XML is faster ?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I haven't seen speed comparisons. But they all (domxml, dom, simplexml) use the same underlying library so there shouldn't be much of a difference.
Post Reply