How to read this attributes in this xml using PHP? : <p><a href="http://idragonlk.com/channels.xml" rel="nofollow noreferrer">http://idragonlk.com/channels.xml</a></p>

<p>This is the xml.</p>

<p>What wanna be is read this channel and programs in a loop.</p>

<pre><code>&lt;?php 
$xmlDoc = new DOMDocument();
$xmlDoc-&gt;load("channels.xml");

$xmlObject = $xmlDoc-&gt;getElementsByTagName('channel');
$itemCount = $xmlObject-&gt;length;

for ($i=0; $i &lt; $itemCount; $i++){
    $title = $xmlObject-&gt;item($i)-&gt;getElementsByTagName('display-name')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
    print "Finished Item $title n&lt;br/&gt;";
}
?&gt;
</code></pre>

<p>I have tried this. But it prints the txt values. I'm unable to get attribute values.</p>

<p>Wanna get value of</p>

<p>channel id=' '</p>

<p>lang='' of display-name</p>

<p>icon src='' value</p>

<p>program start ='' value</p>

<p>program stop = '' value</p>

<p>program channel = '' value</p>

<p>in program rating value</p>

<p>Plz can anyone help me?</p>
