<?php $i = 1; function default_handler ($p, $data) { global $i; print ("$i: default: $datan"); $i++; } function cdata_handler ($p, $data) { global $i; print ("$i: cdata: $datan"); $i++; } $xml = "<foo>bar</foo><?exec command ?>"; $p = xml_parser_create (); xml_set_default_handler ($p, 'default_handler'); xml_set_character_data_handler ($p, 'cdata_handler'); if (!xml_parse ($p, $xml, true)){ die (sprintf ("<br />Parse error in <code>%s</code> (%s)", htmlspecialchars ($xml), xml_error_string (xml_get_error_code ($p)))); } xml_parser_free ($p); ?>
|