< Parser: Define and Execute   (Previous) Table of Contents (Next)   Parser: Character Data Handler >

Parser: Start Tag Handler

/**
 * Processes XML start tags.
 *
 * <p>Activated when an XML element opening tag is reached. The XML parser
 * automatically calls this function. Don't call this manually.</p>
 *
 * @param   mixed    $Parser  variable to contain the current parser's reference id
 * @param   mixed    $Elem    variable to contain the current element's name
 * @param   mixed    $Attr    array to contain the current element's attributes
 */
function saxStartHandler(&$Parser, &$Elem, &$Attr) {

    if ($this->IgnoreTheRest == 'Y') {
        return;
    }

    array_push($this->ParentElements, $Elem);

    //  Is this a root element?
    if ( count($this->ParentElements) == 1 ) {
        //  If don't care about this file type, ignore the rest of it.
        if ( !isset($this->RootElements[$Elem]) ) {
            $this->IgnoreTheRest = 'Y';
            return;
        }
    }

    foreach ($Attr AS $Key => $Value) {
        $this->Data["$Elem:$Key"] = trim($Value);
    }

    $this->CData = array();
}