Beispiel #1
0
/**
 *XML start element handler
 *
 * This function is called whenever a starting element is reached
 * The element handler will be called if found, otherwise it must be HTML
 *
 * @param resource $parser the resource handler for the XML parser
 * @param string   $name   the name of the XML element parsed
 * @param array    $attrs  an array of key value pairs for the attributes
 *
 * @see endElement()
 */
function startElement($parser, $name, $attrs)
{
    global $elementHandler, $processIfs, $processGedcoms, $processRepeats, $vars;
    global $processFootnote;
    $newattrs = array();
    $match = array();
    foreach ($attrs as $key => $value) {
        if (preg_match("/^\\\$(\\w+)\$/", $value, $match)) {
            if (isset($vars[$match[1]]['id']) && !isset($vars[$match[1]]['gedcom'])) {
                $value = $vars[$match[1]]['id'];
            }
        }
        $newattrs[$key] = $value;
    }
    $attrs = $newattrs;
    if ($processFootnote && ($processIfs == 0 || $name == "if") && ($processGedcoms == 0 || $name == "Gedcom") && ($processRepeats == 0 || $name == "Facts" || $name == "RepeatTag")) {
        if (isset($elementHandler[$name]['start'])) {
            if ($elementHandler[$name]['start'] != "") {
                call_user_func($elementHandler[$name]['start'], $attrs);
            }
        } elseif (!isset($elementHandler[$name]['end'])) {
            HTMLSHandler($name, $attrs);
        }
    }
}
/**
 *XML start element handler
 *
 * This function is called whenever a starting element is reached
 * The element handler will be called if found, otherwise it must be HTML
 *
 * @param resource $parser the resource handler for the XML parser
 * @param string $name the name of the XML element parsed
 * @param array $attrs an array of key value pairs for the attributes
 * @see endElement()
 */
function startElement($parser, $name, $attrs)
{
    global $elementHandler, $processIfs, $processGedcoms, $processRepeats, $vars, $cti;
    $newattrs = array();
    //	$temp = "";
    foreach ($attrs as $key => $value) {
        $match = array();
        $ct = preg_match("/^\\\$(\\w+)\$/", $value, $match);
        if ($ct > 0) {
            if (isset($vars[$match[1]]["id"]) && !isset($vars[$match[1]]["gedcom"])) {
                $value = $vars[$match[1]]["id"];
            }
        }
        $newattrs[$key] = $value;
    }
    $attrs = $newattrs;
    if (($processIfs == 0 || $name == "PGVRif") && ($processGedcoms == 0 || $name == "PGVRGedcom") && ($processRepeats == 0 || $name == "PGVRFacts" || $name == "PGVRRepeatTag")) {
        if (isset($elementHandler[$name]["start"])) {
            if ($elementHandler[$name]["start"] != "") {
                call_user_func($elementHandler[$name]["start"], $attrs);
            }
        } else {
            if (!isset($elementHandler[$name]["end"])) {
                HTMLSHandler($name, $attrs);
            }
        }
    }
}