Re: [PHP-XML-DEV] doc root
[email protected] ("Rob Richards")
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
From: Kevin Waterson
> I wish to create a new xml string.
> Is there a method like the old add_root to set the
> document root?
> eg: if I have something like
> $dom = new domDocument;
One way to do this is to do (note that appendChild does NOT check if a root
node already exists):
$dom = new domDocument();
$root = $dom->appendChild(new domElement("elementname", "elementvalue"));
// dump node
echo $dom->saveXML($root);
// dump document
echo $dom->saveXML();
Rob