Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

domxml extension, can't open an XML file

Status
Not open for further replies.

natwod

Programmer
Nov 21, 2002
41
US
I have Apache and PHP installed on my comp, and I recently added the domxml extension, however, when I try to use the domxml_open_file() function, I get the following errors:

Warning: domxml_open_file(): warning: in d:\httpserver\xmlreader.php on line 3

Warning: domxml_open_file(): failed to load external entity "test.xml" in d:\httpserver\xmlreader.php on line 3


Here is the code I'm using:

Code:
if (!$dom = domxml_open_file("test.xml")) { 
	echo "Error while parsing the document<br />"; 
	exit; 
}
else {
	echo "Document opened for reading.<br />";
}

I might have installed the dll incorrectly, but when I use phpinfo(); it shows domxml as having been installed. Any help is greatly appreciated!

Natwod
 
The 'failed to load external entity "test.xml" ' error sounds more to me like a simple file access problem.

Is text.xml in the same directory as your script?



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I agree with sleipnir, put the name as absolute:

if (!$dom = domxml_open_file("/path/to/document/test.xml")

Cheers.
 
I got it to work! I simply used the URL (not the local path) on my network of the file. Any ideas of why worked, but not test.xml? I'm using my comp as a test server, and I'm going to be actually using the script on another server, so it would be nice if I could get a local path working.

Thx
Natwod
 
It's a path problem.

I strongly recommend that you not use a URL to open a file if the file resides on the same server as the script. You're going to have less performance and use more server resources.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top