note 69581 rejected from function.simplexml-element-construct by bobby
| From: | bobby@php.net | Date: | Mon, 11 Sep 2006 21:55:32 +0000 |
| Subject: | note 69581 rejected from function.simplexml-element-construct by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117031@lists.php.net to get a copy of this message | ||
Note Submitter: Lon B
----
According to the these docs (above) for SimpleXMLElement->__construct(), there are several
optional parameters. However, when I try to use the additional "options" parameter, PHP
reports errors.
In my simplest example to reproduce, the code is:
<?php
$testXml = "<root><testnode>hi</testnode></root>";
$xml = new SimpleXMLElement($testXml,LIBXML_NOENT);
echo $xml->root->testnode;[/CODE]
?>
The resulting error is:
<b>Fatal error</b>: Uncaught exception 'Exception' with message
'SimpleXMLElement::__construct() expects exactly 1 parameter, 2 given' in
C:\workspace\eclipse\web\test.php:18
Stack trace:
#0 C:\workspace\eclipse\web\test.php(18):
SimpleXMLElement->__construct('<root><testnode...', 2)
#1 {main}
thrown in <b>C:\workspace\eclipse\web\test.php</b> on line <b>18</b><br
/>
I have checked the various, related versions to make sure my environment supports these options, and
they should.
PHP Version 5.1.1
libXML Version 2.6.11
SimpleXML, Revision $Revision: 1.151.2.7 $
Any assistance would be greatly appreciated!
- Lon
php ( A.T ) lonbinder ( D.O.T) com