$domtree = new DOMDocument('1.0', 'UTF-8');
$xmlparentRoot = $domtree->createElement("activitycollection");
$xmlparentRoot = $domtree->appendChild($xmlparentRoot);
$xmlRoot = $domtree->createElement("activity");
$xmlRoot =$xmlparentRoot->appendChild($xmlRoot);
$xmlRoot->appendChild($domtree->createElement('name',social));
$xmlRoot->appendChild($domtree->createElement('type',general));
$domtree->save("filename.xml");
Above code create the xml File with content
<activitycollection>
<activity>
<name>social</name>
<type>general</type>
</activity>
</activitycollection>
0 Response to "Create XML file in Php"
Post a Comment