1--TEST-- 2Test xml_set_processing_instruction_handler function : basic 3--SKIPIF-- 4<?php 5if (!extension_loaded("xml")) { 6 print "skip - XML extension not loaded"; 7} 8?> 9--FILE-- 10<?php 11class XML_Parser 12{ 13 14 function PIHandler($parser, $target, $data) 15 { 16 echo "Target: " . $target. "\n"; 17 echo "Data: " . $data . "\n"; 18 } 19 20 function parse($data) 21 { 22 $parser = xml_parser_create(); 23 xml_set_object($parser, $this); 24 xml_set_processing_instruction_handler($parser, "PIHandler"); 25 xml_parse($parser, $data, true); 26 xml_parser_free($parser); 27 } 28 29 30} 31 32$xml = <<<HERE 33<?xml version="1.0" encoding="ISO-8859-1"?> 34<?xml-stylesheet href="default.xsl" type="text/xml"?> 35HERE; 36 37echo "Simple test of xml_set_processing_instruction_handler() function\n"; 38$p1 = new Xml_Parser(); 39$p1->parse($xml); 40echo "Done\n"; 41?> 42--EXPECT-- 43Simple test of xml_set_processing_instruction_handler() function 44Target: xml-stylesheet 45Data: href="default.xsl" type="text/xml" 46Done 47