X-Git-Url: https://git.llucax.com/software/bife/bife-all.git/blobdiff_plain/4448c01b82a3d4606d3398b3483d7c1b699a3aa9..f42d10f67726bb642ff6a9adbd04f4aeb0af5121:/index.php diff --git a/index.php b/index.php index ffb2810..8451d92 100644 --- a/index.php +++ b/index.php @@ -1,61 +1,21 @@ "; - foreach ($attrs as $attr => $val) { - echo "$attr: '$val' "; - } - echo "\n"; - @$depth[$parser]++; -} +$template =& new HTML_Template_Sigma('templates'); +$template->setErrorHandling(PEAR_ERROR_PRINT); -function endElement($parser, $name) { - global $depth, $stack; - array_pop($stack); - $depth[$parser]--; -} - -function characterData($parser, $data) { - static $last = ''; - global $depth, $stack; - $current = join('/', $stack); - $data = trim($data); - if ($data) { - echo str_repeat(TAB, @$depth[$parser]); - if ($current !== $last) { - $last = $current; - echo "En $current: "; - } else { - echo " "; - } - echo "'$data'\n"; - } -} - -$xml_parser = xml_parser_create(); -xml_set_element_handler($xml_parser, "startElement", "endElement"); -xml_set_character_data_handler($xml_parser, "characterData"); -if (!($fp = @fopen($file, "r"))) { - die("could not open XML input\n"); -} - -while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } -} -xml_parser_free($xml_parser); +$parser =& new BIFE_Parser($template); +$parser->parseFile($file); +echo $parser->getOutput(); +$parser->__destruct(); ?>