I am trying to read a xml file and echo it to the screen. The xml file is located here if you want to download it:
http://www.thrutherockies.com/words.xml
And the php file:
http://www.thrutherockies.com/words.php
This is the code I am using but it will only show part of the content.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$xml = simplexml_load_file('words.xml');
foreach ($xml->register->table->record as $element)
{
echo "********** table1 **********";
echo "<br>";
$content = $element->content;
$wordChunks = explode("\t", $content);
for($i = 1; $i < count($wordChunks); $i++)
{
echo $i.": ". $wordChunks[$i];
echo "<br>";
}
echo "<br>";
foreach ($xml->register->table->record->table->record as $element2)
{
echo "********** table2 **********";
echo "<br>";
$content2 = $element2->content2;
$wordChunks = explode("\t", $content2);
for($i2 = 1; $i2 < count($wordChunks); $i2++)
{
echo $i2.": ". $wordChunks[$i2];
echo "<br>";
}
foreach ($xml->register->table->record->table->record as $element3)
{
echo "********** table3 **********";
echo "<br>";
$content3 = $element3->content3;
$wordChunks = explode("\t", $content3);
for($i3 = 1; $i3 < count($wordChunks); $i3++)
{
echo $i3.": ". $wordChunks[$i3];
echo "<br>";
}
}
echo "<br>";
echo "<br>";
}
}
?>