function handleChildren($arEls, $path)
{
    foreach ($arEls as $elName => $arEl) {
        if (strpos($path, ",") !== false) {
            if (isset($arEl['*'])) {
                $thirdLevelName = '__bx_thirdLevel_' . $GLOBALS["thirdLevelId"];
                $GLOBALS["thirdLevelId"]++;
                foreach ($arEl['*'] as $cN => $arC) {
                    pushElement($path, $cN, $arC['TITLE'], false, $arC['ICON'], $arC['COMPLEX'], '{DESCRIPTION : \'' . CUtil::JSEscape($arC['DESCRIPTION']) . '\'}', $thirdLevelName, $arC['SCREENSHOT']);
                }
            }
            continue;
        }
        $realPath = $path == '' ? $elName : $path . ',' . $elName;
        pushElement($path, $elName, $arEl['@']['NAME'], true, '', 'N');
        if (isset($arEl['#'])) {
            handleChildren($arEl['#'], $realPath);
        }
        if (is_array($arEl['*']) && !empty($arEl['*'])) {
            foreach ($arEl['*'] as $compName => $arC) {
                pushElement($realPath, $compName, $arC['TITLE'], false, $arC['ICON'], $arC['COMPLEX'], '{DESCRIPTION : \'' . CUtil::JSEscape($arC['DESCRIPTION']) . '\'}', false, $arC['SCREENSHOT']);
            }
        }
    }
}
 * Loads the view.
 */
$viewInfos = new ViewInfos();
$viewInfos->loadFromFile($viewId) or die;
$view = new View($viewInfos);
/*
 * Creates the trace stream handler.
 */
if ($traceHandler === "mock") {
    $trace = new MockTraceHandler();
} else {
    if ($traceHandler === "ktbs") {
        $trace = new KTBSTraceHandler($traceRef, $traceModel);
    } else {
        if ($traceHandler === "file") {
            $trace = new XMLFileTraceHandler($traceRef);
        }
    }
}
/*
 * Streams data to the player from the trace handler, transforming it with the view.
 */
header("Content-type: text/xml");
do {
    $obsel = $trace->getNextObsels($lastKnownId, $lastKnownTime);
    $svgElt = $view->transformSingles($obsel);
    pushElement($svgElt);
} while (!connection_aborted() and !$trace->eot());
if ($trace->eot()) {
    pushElement('<eot/>');
}