Connecting Tech Pros Worldwide Help | Site Map

Warning: domdocument() expects at least 1 parameter

  #1  
Old August 10th, 2006, 12:35 PM
J˙Giusł vs ::NRG::ius
Guest
 
Posts: n/a
Hi all.

I have this script

-----------------------------------------------------------
<?php
$doc = new DOMDocument();
$doc->load('books.xml');
echo $doc->saveXML();
?>
-----------------------------------------------------------


But when I run it I get this ugly message...

-----------------------------------------------------------
Warning: domdocument() expects at least 1 parameter, 0 given in
C:\Programmi\Apache Group\Apache2\htdocs\app\aiml\book.php on line 2
Fatal error: Call to undefined function: load() in C:\Programmi\Apache
Group\Apache2\htdocs\app\aiml\book.php on line 3
-----------------------------------------------------------

My php version is 4.3.8 (with Apache 2.0 on windows 2000).

Any ideas?

Many thanks.

Gius.




  #2  
Old August 10th, 2006, 12:35 PM
J˙Giusł vs ::NRG::ius
Guest
 
Posts: n/a

re: Warning: domdocument() expects at least 1 parameter


I tried to add version number of the instance document and his encoding
but nothing................
........
<?php
//$doc = new DOMDocument();
$dom = new DOMDocument('1.0', 'iso-8859-1');
$doc->load('books.xml');
echo $doc->saveXML();
?>




  #3  
Old August 10th, 2006, 05:25 PM
Iain Adams
Guest
 
Posts: n/a

re: Warning: domdocument() expects at least 1 parameter


Try this again, dont think you noticed but u called the new DOMDocument
$dom instead of $doc;


J˙Giusł vs ::NRG::ius wrote:
Quote:
I tried to add version number of the instance document and his encoding
but nothing................
.......
<?php
//$doc = new DOMDocument();
$dom = new DOMDocument('1.0', 'iso-8859-1');
$doc->load('books.xml');
echo $doc->saveXML();
?>
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML DOM Setup with PHP fionathomson answers 3 November 10th, 2005 08:45 PM
PHP Version 4.3.10 - Warning: domdocument() expects at least 1 parameter, 0 given Mini Mouse answers 1 July 17th, 2005 01:29 PM
problem when outputting an xml file using php mr_burns answers 3 July 17th, 2005 10:44 AM