Annotation of embedaddon/php/ext/xml/tests/xml010.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: XML parser test, attributes
! 3: --SKIPIF--
! 4: <?php
! 5: require_once("skipif.inc");
! 6: if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: function start_elem($parser,$name,$attribs) {
! 11: print "$name ";
! 12:
! 13: foreach($attribs as $key => $value) {
! 14: print "$key = $value ";
! 15: }
! 16: print "\n";
! 17: }
! 18: function end_elem()
! 19: {
! 20: }
! 21:
! 22: $xml = <<<HERE
! 23: <a xmlns="http://example.com/foo"
! 24: xmlns:bar="http://example.com/bar">
! 25: <bar:b foo="bar"/>
! 26: <bar:c bar:nix="null" foo="bar"/>
! 27: </a>
! 28: HERE;
! 29:
! 30: $parser = xml_parser_create_ns("ISO-8859-1","@");
! 31: xml_set_element_handler($parser,'start_elem','end_elem');
! 32: xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
! 33: xml_parse($parser, $xml);
! 34: xml_parser_free($parser);
! 35: ?>
! 36: --EXPECT--
! 37: http://example.com/foo@a
! 38: http://example.com/bar@b foo = bar
! 39: http://example.com/bar@c http://example.com/bar@nix = null foo = bar
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>