Solution:
slip4-p2-q2.php
<?php
$d=new DOMDocument();
$d->load("slip4-p1-q2.xml");
$run=$d->getElementsByTagName('runs');
$wic=$d->getElementsByTagName('wickets');
$name=$d->getElementsByTagName('player');
foreach($name as $n)
{
if($run>='12*00' && $wic>='50')
echo "<br>".$n->textContent;
else "not";
}
?>
slip4-p1-q2.xml
<?xml version='1.0' encoding='UTF-8'?>
<cricketinfo>
<cricket>
<player>abc</player>
<runs>1000</runs>
<wickets>50</wickets>
<noofnotout>10</noofnotout>
</cricket>
<cricket>
<player>def</player>
<runs>100</runs>
<wickets>40</wickets>
<noofnotout>10</noofnotout>
</cricket>
<cricket>
<player>pqr</player>
<runs>1020</runs>
<wickets>60</wickets>
<noofnotout>10</noofnotout>
</cricket>
<cricket>
<player>xyz</player>
<runs>9000</runs>
<wickets>90</wickets>
<noofnotout>40</noofnotout>
</cricket>
<cricket>
<player>lmn</player>
<runs>170</runs>
<wickets>80</wickets>
<noofnotout>8</noofnotout>
</cricket>
</cricketinfo>
0 Comments