Annotation of embedaddon/php/ext/xml/tests/xml011.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: XML Parser test: concat character data and set empty handlers
! 3: --SKIPIF--
! 4: <?php
! 5: require_once("skipif.inc");
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: function start_elem($parser,$name,$attribs) {
! 10: echo "<$name>";
! 11: }
! 12: function end_elem()
! 13: {
! 14: echo "</$name>";
! 15: }
! 16:
! 17: $xml = '<text>start<b /> This & that</text>';
! 18:
! 19: $parser = xml_parser_create();
! 20: xml_parse_into_struct($parser, $xml, $vals, $index);
! 21: print_r($vals);
! 22: xml_parser_free($parser);
! 23:
! 24: echo "\nChange to empty end handler\n";
! 25: $parser = xml_parser_create();
! 26: xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
! 27: xml_set_element_handler($parser,'start_elem','end_elem');
! 28: xml_set_element_handler($parser,'start_elem',NULL);
! 29: xml_parse($parser, $xml, TRUE);
! 30:
! 31: xml_parser_free($parser);
! 32: echo "\nDone\n";
! 33: ?>
! 34: --EXPECT--
! 35: Array
! 36: (
! 37: [0] => Array
! 38: (
! 39: [tag] => TEXT
! 40: [type] => open
! 41: [level] => 1
! 42: [value] => start
! 43: )
! 44:
! 45: [1] => Array
! 46: (
! 47: [tag] => B
! 48: [type] => complete
! 49: [level] => 2
! 50: )
! 51:
! 52: [2] => Array
! 53: (
! 54: [tag] => TEXT
! 55: [value] => This & that
! 56: [type] => cdata
! 57: [level] => 1
! 58: )
! 59:
! 60: [3] => Array
! 61: (
! 62: [tag] => TEXT
! 63: [type] => close
! 64: [level] => 1
! 65: )
! 66:
! 67: )
! 68:
! 69: Change to empty end handler
! 70: <text><b>
! 71: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>