PHP simplexml_load_file -> parsing a php-file with XML-Header



I've a php-file like this (pseudo.php):



<?php
header('Content-Type: application/xml; charset=utf-8');
echo "<mycontainer>";
echo "<foo>bar</foo>";
echo "</mycontainer>";
?>


If I open this file in a Webbrowser I get the well formed XML-Content and also the W3C-Validation confirms well formed XML. But it's not possible to parse this file with simplexml_load_file:



$xml = simplexml_load_file("pseudo.php");


returns:



parser error : Start tag expected


is there a workaround or such like? Thanx for your help.


No comments:

Post a Comment