Create a XML file which gives details of movies available in
“Mayanagari CD Store” from following categories
a) Classical
b) Action
c) Horror
movies.php
<?php
$doc=new DOMDocument("1.0","UTF-8");
$xmlfile="movie.xml";
$root=$doc->createElement("Mayanagari_CD_Store");
$classical=$doc->createElement("Classical");
$mn=$doc->createElement("Movie_Name","North_by_Northwest");
$classical->appendChild($mn);
$re=$doc->createElement("Release_Year",1959);
$classical->appendChild($re);
$action=$doc->createElement("Action");
$mn=$doc->createElement("Movie_Name","Miss_Bala");
$action->appendChild($mn);
$re=$doc->createElement("Release_Year",2019);
$action->appendChild($re);
$horror=$doc->createElement("Horror");
$mn=$doc->createElement("Movie_Name","Thriller");
$horror->appendChild($mn);
$re=$doc->createElement("Release_Year",2019);
$horror->appendChild($re);
$root->appendChild($classical);
$root->appendChild($action);
$root->appendChild($horror);
$doc->appendChild($root);
$doc->save("movie.xml");
echo '<a href="movie.xml">Click Here </a>';
?>

0 Comments
If anyone has Doubts or suggestions please let me know