
February 23rd, 2013, 03:46 PM
|
 |
A Change of Season
|
|
|
|
|
Catchable fatal error: Object of class DOMNodeList could not be converted to string
What am I doing wrong?
PHP Code:
<?php $xml = new DOMDocument;
$xml->load('test.xml');
foreach($xml->getElementsByTagname('show') as $show)
{
echo $string = $show->getElementsByTagname('Name');
}?>
Code:
<?xml version="1.0" encoding="utf-8"?>
<shows>
<show id="1">
<Name>CNN</Name>
<time>1 pm</time>
</show>
<show id="2">
<Name>BBC</Name>
<time>12 pm</time>
</show>
<show id="3">
<Name>ABS</Name>
<time>3.45 pm</time>
</show>
<show id="4">
<Name>HBO</Name>
<time>10 am</time>
</show>
<show id="5">
<Name>Tonight's Late Nighte</Name>
<time>Mid night</time>
</show>
</shows>
|