1--TEST-- 2XML parser case folding test 3--SKIPIF-- 4<?php include("skipif.inc"); ?> 5--FILE-- 6<?php 7chdir(dirname(__FILE__)); 8 9$xp = xml_parser_create(); 10xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false); 11xml_set_element_handler($xp, "start_element", "end_element"); 12$fp = fopen("xmltest.xml", "r"); 13while ($data = fread($fp, 4096)) { 14 xml_parse($xp, $data, feof($fp)); 15} 16xml_parser_free($xp); 17$xp = xml_parser_create(); 18xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true); 19xml_set_element_handler($xp, "start_element", "end_element"); 20$fp = fopen("xmltest.xml", "r"); 21while ($data = fread($fp, 4096)) { 22 xml_parse($xp, $data, feof($fp)); 23} 24xml_parser_free($xp); 25 26function start_element($xp, $elem, $attribs) 27{ 28 print "<$elem"; 29 if (sizeof($attribs)) { 30 while (list($k, $v) = each($attribs)) { 31 print " $k=\"$v\""; 32 } 33 } 34 print ">\n"; 35} 36 37function end_element($xp, $elem) 38{ 39 print "</$elem>\n"; 40} 41?> 42--EXPECT-- 43<root id="elem1"> 44<elem1> 45<elem2> 46<elem3> 47<elem4> 48</elem4> 49</elem3> 50</elem2> 51</elem1> 52</root> 53<ROOT ID="elem1"> 54<ELEM1> 55<ELEM2> 56<ELEM3> 57<ELEM4> 58</ELEM4> 59</ELEM3> 60</ELEM2> 61</ELEM1> 62</ROOT> 63