...

View Full Version : Php5 Xml Dom



sir pannels
02-27-2007, 04:03 PM
Yo all,

I could not decide if this goes here or XML forum, as it may be a php config issue. Please move if you think its wrong place.

Anyways I have the below, creates a new dom document and loads in some xml ...



<?
print "this gets displayed";
$dom = new DomDocument();
$dom->load("http://localhost/file.xml");
print "this does not get displayed";
?>


The file is in the specified location.

This does not work. Funny thing is no error, just kills the script. Anything before the new DomDocument(); gets processed but anything after it does.. as it the code breaks the script.. but no actual errors or php warnings.

It is Suse 10.1 and PHP 5.1.2. The 'dom' works on there for javascript. Is it the same one it uses or different? or did i miss understand?

If anyone can tell me where to look to resolve this it be much apperciated.

Warm Regards,
Sir P

ralph l mayo
02-27-2007, 04:29 PM
Snippet works fine for me with some XML file I had laying around, can you post the actual document you're working with?

sir pannels
02-27-2007, 05:02 PM
Snippet works fine for me with some XML file I had laying around, can you post the actual document you're working with?


Thats the entire document Ralph :)

Just hangs on the new DomDocument part... which is why I wonder if dom or php config somewhere?


any ideas?

and yup i can get that code to work on another platform.

cheers

ralph l mayo
02-27-2007, 06:28 PM
I mean file.xml...

Other ideas: make sure your error reporting is on and set at a low threshold. See if something ends up in apache's logs.

sir pannels
02-28-2007, 10:21 AM
Morning Ralph.

The xml file works using that code on another platform, so the file is fine. Also I removed the load file bit so I only have the new DomDocument line and it still does the same.

Ah ha... Looking in apache error_log...


[Wed Feb 28 09:18:07 2007] [error] [client 127.0.0.1] PHP Fatal error: Class 'DomDocument' not found in /srv/www/htdocs/xml.php on line 4


So, that class is not there. But I thought it was part of PHP 5 core? libxml 2.62.1 is showing in phpinfo() as active and enabled.
I'm going to browse the php.net site but if you have any ideas, please let me know.

many thanks :)

sir pannels
03-01-2007, 12:12 PM
d'oh is everyone as stumped as me ?

sir pannels
03-01-2007, 12:45 PM
I have found the problem and resolved it!

For any of you that come across this issue.. although I had lib2xml installed, I did not have php5-dom installed.

Cheers for the help all.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum