This is what I am using to parse the data
[php]
class permit_data_parser
{
function get_permit_data_from_xml($filename){
if (file_exists($filename)){
$result = simplexml_load_file($filename);
return $this->parse_raw_xml_permit_data($result);
}
return ‘File not found’;
}
function parse_raw_xml_permit_data($xml){
$results = ‘’;
foreach($xml->Body->Table->Records->Record as $record)
{
$results = $results.‘Record’.""\n";
foreach($record->attributes() as $name => $value) {
$results = $results . $name . ‘="’ . $value . “”\n";
}
// $results = $results.‘Pests’.""\n";
// foreach($xml->Body->Table->Records->Record->PESTS->PEST as $pest)
// {
// foreach($pest->attributes() as $name => $value) {
// $results = $results . $name . ‘="’ . $value . “”\n";
// }
// }
$results = $results.‘Sites’.""\n";
foreach($xml->Body->Table->Records->Record->SITES->SITE as $site)
{
foreach($site->attributes() as $name => $value) {
$results = $results . $name . ‘="’ . $value . “”\n";
}
}
$results = $results.‘Site Pests’.""\n";
foreach($xml->Body->Table->Records->Record->SITES->SITE->SITEPESTS->SITEPEST as $sitepest)
{
foreach($sitepest->attributes() as $name => $value) {
$results = $results . $name . ‘="’ . $value . “”\n";
}
}
}
return $results;
}
[/php]