473,406 Members | 2,345 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,406 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 3964
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.