Loading XML into php giving error

I am trying to load xml in php

$doc = new DOMDocument();
$doc->load("LoginVal.xml");

      

I am getting an error like

Warning: domdocument :: domdocument () expects at least 1 parameter, 0 is set in C: \ Program Files \ Apache Group \ Apache2 \ htdocs \ hello.php on line 5

Fatal error: Call to undefined domdocument :: load () method in C: \ Program Files \ Apache Group \ Apache2 \ htdocs \ hello.php on line 7

Regards, Hemant

+2


source to share


5 answers


It's a shame that the constructor is missing a parameter . Try something like



$dom = new DOMDocument('1.0', 'iso-8859-1');

      

+1


source


The fatal error is that the object was created, the warning is as it says it is pending parameter validation http://us3.php.net/manual/en/domdocument.construct.php



0


source


Take a look at the comment in here , it looks like a known issue (especially comment # 2).

0


source


Please read the user's comments in DOMDocument::__construct()

. This error says that when using PHP5 on Windows machines (which is most likely your configuration). I am quoting Christian reinecke dot in web dot de :

[...] make sure you don't overwrite this dom library with another one (fe extension = php_domxml.dll in php.ini). XAMPP fe delivers its standard version with php_domxml.dll which ends in this error message

Make sure php.ini

no php_domxml.dll

-extension exists .

0


source


try the full path to the file

Your

$doc = new DOMDocument();
$doc->load("LoginVal.xml");

      

Try

$doc = new DOMDocument();
$doc->load("/path/to/LoginVal.xml");

      

0


source







All Articles