Connecting Tech Pros Worldwide Help | Site Map

PHP Version 4.3.10 - Warning: domdocument() expects at least 1 parameter, 0 given

Mini Mouse
Guest
 
Posts: n/a
#1: Jul 17 '05
Hiya folks,

I'm getting the following error(s) below and I'm at a bit of a loss as
to how to correct it. When I give it a parameter it then complains it
needs two parameters and the second one being an integer or something
like that.

Warning: domdocument() expects at least 1 parameter, 0 given in
orders.php on line 157

Warning: domdocument() expects at least 1 parameter, 0 given in
orders.php on line 158

Fatal error: Call to undefined function: loadxml() in orders.php on
line 159

The lines in question are:
$xml = new DOMDocument;
$xsl = new DOMDocument;
$xml->loadXML($row['fetch_orders']);
$xsl->load('fetch_orders.xsl');
$proc = new xsltprocessor;

phpinfo shows the following:
Loaded Modules: mod_php4, mod_setenvif, mod_so, mod_unique_id,
mod_log_forensic, mod_usertrack, mod_headers, mod_expires,
mod_cern_meta, mod_proxy, mod_digest, mod_auth_db, mod_auth_anon,
mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_speling,
mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex,
mod_include, mod_info, mod_status, mod_negotiation, mod_mime,
mod_mime_magic, mod_log_config, mod_define, mod_env, mod_vhost_alias,
mod_mmap_static, http_core

domxml
DOM/XML enabled
DOM/XML API Version 20020815
libxml Version 20616
HTML Support enabled
XPath Support enabled
XPointer Support enabled
DOM/XSLT enabled
libxslt Version 1.1.12
libxslt compiled against libxml Version 2.6.16
DOM/EXSLT enabled
libexslt Version 1.1.12

xml
XML Support active
XML Namespace Support active
EXPAT Version expat_1.95.8

xslt
XSLT support enabled
Backend Sablotron
Sablotron Version 1.0.1
Sablotron Information Cflags: -O -pipe Libs: -L/usr/local/lib -liconv
-lexpat Prefix: /usr/local

Mini Mouse
Guest
 
Posts: n/a
#2: Jul 17 '05

re: PHP Version 4.3.10 - Warning: domdocument() expects at least 1 parameter, 0 given



Mini Mouse wrote:[color=blue]
> Hiya folks,
>
> I'm getting the following error(s) below and I'm at a bit of a loss[/color]
as[color=blue]
> to how to correct it. When I give it a parameter it then complains it
> needs two parameters and the second one being an integer or something
> like that.
>
> Warning: domdocument() expects at least 1 parameter, 0 given in
> orders.php on line 157
>
> Warning: domdocument() expects at least 1 parameter, 0 given in
> orders.php on line 158
>
> Fatal error: Call to undefined function: loadxml() in orders.php on
> line 159
>
> The lines in question are:
> $xml = new DOMDocument;
> $xsl = new DOMDocument;
> $xml->loadXML($row['fetch_orders']);
> $xsl->load('fetch_orders.xsl');
> $proc = new xsltprocessor;
>
> phpinfo shows the following:
> Loaded Modules: mod_php4, mod_setenvif, mod_so, mod_unique_id,
> mod_log_forensic, mod_usertrack, mod_headers, mod_expires,
> mod_cern_meta, mod_proxy, mod_digest, mod_auth_db, mod_auth_anon,
> mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir,[/color]
mod_speling,[color=blue]
> mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex,
> mod_include, mod_info, mod_status, mod_negotiation, mod_mime,
> mod_mime_magic, mod_log_config, mod_define, mod_env, mod_vhost_alias,
> mod_mmap_static, http_core
>
> domxml
> DOM/XML enabled
> DOM/XML API Version 20020815
> libxml Version 20616
> HTML Support enabled
> XPath Support enabled
> XPointer Support enabled
> DOM/XSLT enabled
> libxslt Version 1.1.12
> libxslt compiled against libxml Version 2.6.16
> DOM/EXSLT enabled
> libexslt Version 1.1.12
>
> xml
> XML Support active
> XML Namespace Support active
> EXPAT Version expat_1.95.8
>
> xslt
> XSLT support enabled
> Backend Sablotron
> Sablotron Version 1.0.1
> Sablotron Information Cflags: -O -pipe Libs: -L/usr/local/lib[/color]
-liconv[color=blue]
> -lexpat Prefix: /usr/local[/color]

Did the research on this and since I didn't get any responses I found
that I had to change the code in order to resolve it. Seems that
there's something funky in php4 domxml, but why I don't know.
[color=blue]
> The lines in question are:
> $xml = new DOMDocument;
> $xsl = new DOMDocument;
> $xml->loadXML($row['fetch_orders']);
> $xsl->load('fetch_orders.xsl');
> $proc = new xsltprocessor;[/color]

The new lines are:
$xml = new Domdocument($row['fetch_order']);
$xsl=domxml_xslt_stylesheet_file("fetch_order.xsl" );
//Actually on the above line you may need to put in the full path.
$output = $xsl->process($xml);
echo $output->dump_mem();

Another way would be something like this:
$sql = "select fetch_orders('$who')";
$result = pg_query($sql);
$row = pg_fetch_array($result);
$xml=domxml_open_mem($row['fetch_orders']);
$xsl=domxml_xslt_stylesheet_file('fetch_orders.xsl ');
$output = $xsl->process($xml);
echo $output->dump_mem();

Closed Thread


Similar PHP bytes