我如何在php文件中阅读下面的xml,以便输出应该是php中的表。
<?xml version="1.0" ?>
<Response command="GenerateReport" module="DB" status = "success">
<Applied_Filters>
<Groups> Customer_Name</Groups>
<Period>01/24/2015</Period>
<Time_Zone>India Standard Time</Time_Zone>
</Applied_Filters>
<Report name="All Nodes CPU Usage">
<Row>
<Column id="Node" name="Node">azim</Column>
<Column id="ResourceName" name="ResourceName">0</Column>
<Column id="MaxUsage(%)(graph)" name="MaxUsage">13.00</Column>
<Column id="AvgUsage(%)(graph)" name="AvgUsage">2.19</Column>
</Row>
<Row>
<Column id="Node" name="Node">azim</Column>
<Column id="ResourceName" name="ResourceName">FG100</Column>
<Column id="MaxUsage(%)(graph)" name="MaxUsage">3.00</Column>
<Column id="AvgUsage(%)(graph)" name="AvgUsage">2.18</Column>
</Row>
</Report>
</Response>
我已经尝试了下面的PHP代码,不幸的是我收到错误&#34;致命错误:在非对象上调用成员函数item()&#34;
<?php
// This is a simple example on how to draw a chart using FusionCharts and PHP.
// We have included includes/fusioncharts.php, which contains functions
// to help us easily embed the charts.
include('fusioncharts.php');
$doc = new DOMDocument();
$doc->load('response.xml');
$employees = $doc->getElementsByTagName("Row");
foreach( $employees as $Row )
{
$names = $Row->getAttribute("Node");
$Node = $names->item(0)->nodeValue;
$ages= $Row->getAttribute("MaxUsage");
$MaxUsage= $ages->item(0)->nodeValue;
$salaries = $Row->getAttribute("AvgUsage");
$AvgUsage = $salaries->item(0)->nodeValue;
echo "<b>$Node - $MaxUsage - $AvgUsage\n</b><br>";
}
?>