I am having an issue parsing an XML file. I have other PHP scripts that do this but for some reason this one just won't work.
XML Example:
<Data>
<Email>
<Subject>Email</Subject>
<Sender>Sender</Sender>
<Recipients>'recipient1', recipient2</Recipients>
<Date>2014-02-24T22:37:16Z</Date>
<Size>16 KB</Size>
<Url>URL</Url>
</Email>
</Data>
and
PHP Example:
<?php
$file="data.xml";
$xml = simplexml_load_file($file) or die ('Cant Load XML');
echo "
<table>
<tr>
<th>Subject</th>
<th>Sender</th>
<th>Recipients</th>
<th>Date/Time</th>
<th>Size</th>
<th>Link</th>
</tr>
";
foreach($xml->Data as $data){
foreach($data->children() as $he => $email){
echo "<tr>";
echo "<td>{$email->Subject}</td>";
echo "<td>{$email->Sender}</td>";
echo "<td>{$email->Recipients}</td>";
echo "<td>{$email->Date}</td>";
echo "<td>{$email->Size}</td>";
echo "<td><a href={$email->URL}>Link</a></td>";
echo "<br />";
echo "</tr>";
}}
echo '</table>';
?>
I get the header rows but after that it seems like nothing processes. I do not get an error so it seems to be loading the XML. Not sure why this one is not working but similar scripts I have do. Maybe a fresh pair of eyes would help?