1--TEST--
2Test xml_set_notation_decl_handler function : basic
3--EXTENSIONS--
4xml
5--FILE--
6<?php
7class XML_Parser
8{
9
10    function unparsed_entity_decl_handler($parser, $entity_name, $base, $system_ID, $public_ID, $notation_name)
11    {
12        echo "unparsed_entity_decl_handler called\n";
13        echo "...Entity name=" . $entity_name . "\n";
14        echo "...Base=" . $base . "\n";
15        echo "...System ID=" . $system_ID . "\n";
16        echo "...Public ID=" . $public_ID . "\n";
17        echo "...Notation name=" . $notation_name . "\n";
18    }
19
20    function notation_decl_handler($parser, $name, $base, $system_ID,$public_ID)
21    {
22        echo "notation_decl_handler called\n";
23        echo "...Name=" . $name . "\n";
24        echo "...Base=" . $base . "\n";
25        echo "...System ID=" . $system_ID . "\n";
26        echo "...Public ID=" . $public_ID . "\n";
27    }
28
29    function parse($data)
30    {
31        $parser = xml_parser_create();
32        xml_set_object($parser, $this);
33        xml_set_notation_decl_handler($parser, "notation_decl_handler");
34        xml_set_unparsed_entity_decl_handler($parser, "unparsed_entity_decl_handler");
35        xml_parse($parser, $data, true);
36        xml_parser_free($parser);
37    }
38}
39
40$xml = <<<HERE
41<?xml version="1.0"?>
42<!DOCTYPE dates [
43    <!NOTATION USDATE SYSTEM "http://www.schema.net/usdate.not">
44    <!NOTATION AUSDATE SYSTEM "http://www.schema.net/ausdate.not">
45    <!NOTATION ISODATE SYSTEM "http://www.schema.net/isodate.not">
46    <!ENTITY testUS  SYSTEM "test_usdate.xml" NDATA USDATE>
47    <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE>
48    <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]>
49]>
50HERE;
51
52echo "Simple test of xml_set_notation_decl_handler(() function\n";
53$p1 = new Xml_Parser();
54$p1->parse($xml);
55echo "Done\n";
56?>
57--EXPECT--
58Simple test of xml_set_notation_decl_handler(() function
59notation_decl_handler called
60...Name=USDATE
61...Base=
62...System ID=http://www.schema.net/usdate.not
63...Public ID=
64notation_decl_handler called
65...Name=AUSDATE
66...Base=
67...System ID=http://www.schema.net/ausdate.not
68...Public ID=
69notation_decl_handler called
70...Name=ISODATE
71...Base=
72...System ID=http://www.schema.net/isodate.not
73...Public ID=
74unparsed_entity_decl_handler called
75...Entity name=testUS
76...Base=
77...System ID=test_usdate.xml
78...Public ID=
79...Notation name=USDATE
80unparsed_entity_decl_handler called
81...Entity name=testAUS
82...Base=
83...System ID=test_ausdate.xml
84...Public ID=
85...Notation name=AUSDATE
86unparsed_entity_decl_handler called
87...Entity name=testISO
88...Base=
89...System ID=test_isodate_xml
90...Public ID=
91...Notation name=ISODATE
92Done
93