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