Posted by Janwillem Borleffs on 11/10/05 22:34
fionathomson wrote:
> As suggested I have added the version to the constructor. I am now
> getting a new error message:
>
> Warning: domdocument(): Start tag expected, '<' not found in test.php
> on line 4
>
It appears that the implementation doesn't follow the documentation: the
first argument supplied must be a valid xml document.
The following appears to work fine:
$dom = new DomDocument('<root />');
This will create a document with like the following:
<?xml version="1.0"?>
<root/>
If you want to set the encoding, you can do the following:
$dom = new DomDocument(
'<?xml version="1.0" encoding="utf-8"?><root />'
);
This will create the following document:
<?xml version="1.0" encoding="utf-8"?>
<root/>
HTH;
JW
Navigation:
[Reply to this message]
|