473,249 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,249 software developers and data experts.

Just installed DOMXML and getting error when loading an XML file / string

Hi,

I have just managed to install DOMXML on my apache/PHP setup. I am
running PHP 4.3.0 and Apache2.

$xmldoc = domxml_open_file("inc/menu.xml",
DOMXML_LOAD_DONT_KEEP_BLANKS);

When I try to load an XML file using the above, it gives me the
following error:

Warning: domxml_open_file(): I/O in
C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line 147

Warning: domxml_open_file(): warning : in
C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line 147

Warning: domxml_open_file(): failed to load external entity
"inc/menu.xml" in C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on
line 147
I have also tried to load the contents of the xml file into a string in
the following way:
$content = file_get_contents("inc/menu.xml");

$xml_doc = domxml_open_mem($content, DOMXML_LOAD_DONT_KEEP_BLANKS);
...giving me the following error:
Warning: domxml_open_mem(): Opening and ending tag mismatch: opt line 4
and menu in C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line
147

Warning: domxml_open_mem(): Premature end of data in tag menu line 2 in
C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line 147
Is PHP recognising the DOMXML functions? I have tried using an XML file
that I know works as well as just loading a very simple one in but it
still gives me an error. I also tried using xmldocfile() but I got the
same error. Any ideas?

Burnsy

Sep 3 '05 #1
5 3956
bi******@yahoo.co.uk said the following on 03/09/2005 14:36:
Hi,

I have just managed to install DOMXML on my apache/PHP setup. I am
running PHP 4.3.0 and Apache2.

$xmldoc = domxml_open_file("inc/menu.xml",
DOMXML_LOAD_DONT_KEEP_BLANKS);

When I try to load an XML file using the above, it gives me the
following error:

Warning: domxml_open_file(): I/O in
C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line 147

Warning: domxml_open_file(): warning : in
C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line 147

Warning: domxml_open_file(): failed to load external entity
"inc/menu.xml" in C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on
line 147
I have also tried to load the contents of the xml file into a string in
the following way:
$content = file_get_contents("inc/menu.xml");

$xml_doc = domxml_open_mem($content, DOMXML_LOAD_DONT_KEEP_BLANKS);
..giving me the following error:
Warning: domxml_open_mem(): Opening and ending tag mismatch: opt line 4
and menu in C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line
147

Warning: domxml_open_mem(): Premature end of data in tag menu line 2 in
C:\apache\Apache2\htdocs\webdev\cms\inc\menu.php on line 147


Can you post the XML you are trying to read?
--
Oli
Sep 3 '05 #2
> Can you post the XML you are trying to read?

<?xml version="1.0" encoding="iso-8859-1"?>
<menu>
<opt title="Home" href="index.php" />
<opt title="About us" href="about.php" />
<opt title="Products" href="products.php" />
<opt title="Support" href="support.php" />
<opt title="Contact us" href="contact.php" />
</menu>

Burnsy

Sep 4 '05 #3
Ok, Ive found something out...

It appears that I need to use the full path of the file. Ive had a
similar problem before with relative paths but got round it using
file_get_cotents() and domxml_open_mem() but this time it wont let me.

Why is it that I have used DOMXML plenty of times before and havent had
many instances with relative paths. Is this a configuration problem? Or
maybe its a Windows thing?

Is there a way to get the full path of a relative file and store it in
a string prior to using domxml_open_file() as I transfer stuff from my
own computer to a server.

Burnsy

Sep 4 '05 #4
bi******@yahoo.co.uk said the following on 04/09/2005 22:27:
Ok, Ive found something out...

It appears that I need to use the full path of the file. Ive had a
similar problem before with relative paths but got round it using
file_get_cotents() and domxml_open_mem() but this time it wont let me.

Why is it that I have used DOMXML plenty of times before and havent had
many instances with relative paths. Is this a configuration problem? Or
maybe its a Windows thing?


One thing I just spotted in the manual page for domxml_open_mem():

"There is some interesting feature with "magic_quotes_runtime" ini
directive and "domxml_open_mem" function.
If we have "magic_quotes_runtime=on" in out php.ini file, this code
generates many warning
$xml_str = file_get_contents($xml_file));
$Document = domxml_open_mem($xml_str));
if "magic_quotes_runtime=off" all is good."
Does this help?

--
Oli
Sep 5 '05 #5
bi******@yahoo.co.uk wrote:
Ok, Ive found something out...

It appears that I need to use the full path of the file. Ive had a
similar problem before with relative paths but got round it using
file_get_cotents() and domxml_open_mem() but this time it wont let me.

Why is it that I have used DOMXML plenty of times before and havent had
many instances with relative paths. Is this a configuration problem? Or
maybe its a Windows thing?

Is there a way to get the full path of a relative file and store it in
a string prior to using domxml_open_file() as I transfer stuff from my
own computer to a server.

Burnsy


Check out $_SERVER['DOCUMENT_ROOT']
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 5 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Terence | last post by:
The XML (expat) extension to PHP contains specific functions for accessing detailed error information when an error occurs parsing an XML packet. All be it convoluted, even the XSLT (Sablotron)...
4
by: webguynow | last post by:
need the straight dope on domxml for Windows ! Is it bundled or are DLL's necessary ? Also, what changes are needed in php.ini ? My setup: WXP, PHP 5.0.2 as an Apache Module, libxml v2.6.11...
0
by: Joel Witherspoon | last post by:
I'm using: Windows 2k Apache 2.0.47 PHP 4.3.5 I've used PHP for a while with no problems. I've upgraded from 4.3.2 to 4.3.5. Using Apache 2 (I know it's "experimental"), has not presented a...
1
by: BuddyWork | last post by:
Hello, When a particular user (has administrator rights) on a Windows 2000 Server SP4 tries to run any MSI's we get the message mentioned in the subject. If we logon with another user that has...
10
by: musosdev | last post by:
Hi guys I'm trying to migrate to VS2005... I've managed to do that, but realised I'd opened my web projects as file projects, and I'm getting the error about network BIOS command limit. ...
1
by: bizt | last post by:
Hi Please forgive the length of this post and bear with me. I am having trouble between two different servers and the same DOMXML code. Basically I am trying to run a script that will: 1)...
1
by: dhiraaj1983 | last post by:
I have been trynig to implement the Google Adwords API in my account. For this i downloaded their API library with PHP scripts to run the projexct. It required me to uncomment php_curl.dll and...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
4
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.