php中dom生成的xml如何输出到页面上
$id= $_GET['id'];
$n = $_GET['n'];
//包含数据库连接文件
include('conn.php');
$dom=new DomDocument('1.0', 'utf-8');
$dom->formatOutput = true;
if($category == ""){
exit;
};
// 创建根节点
$element = $dom->createElement('element');
$dom->appendchild($element);
$element->setAttribute('n',$n);
$query = mysql_query( "select * from pictures order by LevelID='$id'" );
while( $result = mysql_fetch_array( $query ) )
{
$t=$dom->createElement('e');
$t->setAttribute('cr',$result['c']);
$t->setAttribute('isNew',$result['isNew']);
$t->setAttribute('fileUrl',$result['fileUrl']);
$element->appendChild($t);
print_r($dom->saveXML());
}
echo $dom->saveXML();
?>
我用print和echo都不能把dom输出到页面上,
请问php里dom生成的xml如何能被输出到页面上,谢谢