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_processing_instruction_handler($parser, $this->PIHandler(...));
20        xml_parse($parser, $data, true);
21        xml_parser_free($parser);
22    }
23
24
25}
26
27$xml = <<<HERE
28<?xml version="1.0" encoding="ISO-8859-1"?>
29<?xml-stylesheet href="default.xsl" type="text/xml"?>
30HERE;
31
32echo "Simple test of xml_set_processing_instruction_handler() function\n";
33$p1 = new Xml_Parser();
34$p1->parse($xml);
35echo "Done\n";
36?>
37--EXPECT--
38Simple test of xml_set_processing_instruction_handler() function
39Target: xml-stylesheet
40Data: href="default.xsl" type="text/xml"
41Done
42