I am new in creating XML file using php..I wrote a code but the code doesnot show xml file on running it..Can anybody figure out what the problem is
the code is as follows
<?php
$dom = new DOMDocument('1.0', 'UTF-8');
$root=$dom->createElement("xml");
$dom->appendChild($root);
$title=$dom->createElement("title");
$root->appendChild($title);
$path=$dom->createElement("path");
$title->appendChild($path);
$title=$dom->createTextNode("pepperoni");
$path->appendChild($title);
echo $dom->saveXML();
?>
i want to get output as
<xml>-as root
<title>
<path>pepperoni</path>
</title>
</xml>