frankx: simplexml Ausgabe zeigt nichts an

Beitrag lesen

Hellihello Christian,

try thisone:

  
<?php  
ob_start();  
echo "<?"?>xml version="1.0" encoding="utf-8"?>  
<ProgramList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
  <TotalRecords>12</TotalRecords>  
  <Programs>  
    <ProgramSummary>  
      <ProgramID>1</ProgramID>  
      <Title>Blabla 1</Title>  
    </ProgramSummary>  
    <ProgramSummary>  
      <ProgramID>2</ProgramID>  
      <Title>Blabla 2</Title>  
    </ProgramSummary>  
  </Programs>  
</ProgramList>  
  
<?php  
$xml_string=ob_get_clean();  
?>  
<?php  
  
$xml = simplexml_load_string($xml_string);  
  
  
echo "total records:  
 $xml->TotalRecords  
---  
";  
echo "Programm Summary Title 1 :  
". $xml->Programs->ProgramSummary[0]->Title ."  
---  
";  
foreach($xml->Programs->ProgramSummary as $key => $news) {  
 var_dump($news);  
 echo $key .": ". $news->Title."<br>";  
}  
?>  

Gruß,

frankx