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