Solution:
<html>
<head>
<link rel="stylesheet" type="text/css" href="book.css">
</head>
<body>
<?php
$xml=simplexml_load_file('movie.xml')or die("cannot die");
?>
<center>
</b>CD details</b></center>
<table border="1">
<th>cdcode</th>
<th>mname</th>
<th>ryear</th>
<th>aname</th>
<?php
foreach($xml->category as $a)
{
echo"<tr><td>".$a['code']."</td>";
echo"<td>".$a->mname."</td>";
echo"<td>".$a->ryear."</td>";
echo"<td>".$a->aname."</td></tr>";
}
?>
</table>
</body>
</html>
Movie.xml
<?xml version="1.0" ?>
<bookinfo>
<category code="classical">
<mname>Geet</mname>
<ryear>1974</ryear>
<aname>jitendra</aname>
</category>
<category code="action">
<mname>Pushpa</mname>
<ryear>2022</ryear>
<aname>Allu</aname>
</category>
</bookinfo>
0 Comments