Re: Error with DOMDocument->saveXML()
| From: | Stephen Leaf | Date: | Thu, 29 Sep 2005 17:40:19 +0000 |
| Subject: | Re: Error with DOMDocument->saveXML() | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223421@lists.php.net to get a copy of this message | ||
On Thursday 29 September 2005 12:26 pm, Stephen Leaf wrote:
I have figured it out!
My guess couldn't have been more _wrong_.
Here is all you need to recreate the Error.
There is only 1 value that is off.
in the DOMDocument I gave it the wrong encoding type.
uft-8 .. it should read utf-8.
Interesting that PHP doesn't tell you about a bad encoding type.
<?php
class test {
private $Dom;
function __construct ($rootName) {
$this->Dom = new DOMDocument('1.0', 'uft-8');
$this->Dom->appendChild($this->Dom->createElement($rootName));
}
function __toString() {
return $this->Dom->saveXML();
}
}
$test = new test("test");
echo $test;
?>