function parseEPGDataXMLTV($providerId)
{
    global $stationsXML, $programsXML, $schedulesXML, $baseTime;
    global $config, $numStations, $numPrograms, $numSchedules;
    $response = getEPGDataXMLTV($providerId);
    $stations = $response->channel;
    $stationsXML = getStationsXMLTV($stations, $providerId);
    $numStations = sizeof($stations);
    $programs = $response->programme;
    $programsXML = getProgramsXMLTV($programs);
    $schedulesXML = getSchedulesXMLTV($programs);
    $numSchedules = sizeof($programs);
}
    } else {
        if ($config['providers'][$providerId]['epg-source'] == 'sd') {
            echo "\t<ErrorCode>0</ErrorCode>\n";
            echo "\t<ErrorDescription>OK</ErrorDescription>\n";
            $response = getEPGData($providerId);
            $stations = $response->xtvd->stations->station;
            $lineups = $response->xtvd->lineups->lineup->map;
            $stationsXML = getStationsXML($stations, $lineups, $providerId);
        } else {
            if ($config['providers'][$providerId]['epg-source'] == 'xmltv') {
                echo "\t<ErrorCode>0</ErrorCode>\n";
                echo "\t<ErrorDescription>OK</ErrorDescription>\n";
                require_once 'functions-xmltv.inc.php';
                $response = getEPGDataXMLTV($providerId);
                $stations = $response->channel;
                $stationsXML = getStationsXMLTV($stations, $providerId);
            }
        }
    }
}
?>
	<StationCount><?php 
echo sizeof($stations);
?>
</StationCount>
	<UsingCachedData><?php 
echo $usingCache;
?>
</UsingCachedData>
<?php 
echo $stationsXML;