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_notation_decl_handler($parser, $this->notation_decl_handler(...)); 33 xml_set_unparsed_entity_decl_handler($parser, $this->unparsed_entity_decl_handler(...)); 34 xml_parse($parser, $data, true); 35 xml_parser_free($parser); 36 } 37} 38 39$xml = <<<HERE 40<?xml version="1.0"?> 41<!DOCTYPE dates [ 42 <!NOTATION USDATE SYSTEM "http://www.schema.net/usdate.not"> 43 <!NOTATION AUSDATE SYSTEM "http://www.schema.net/ausdate.not"> 44 <!NOTATION ISODATE SYSTEM "http://www.schema.net/isodate.not"> 45 <!ENTITY testUS SYSTEM "test_usdate.xml" NDATA USDATE> 46 <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE> 47 <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]> 48]> 49HERE; 50 51echo "Simple test of xml_set_notation_decl_handler(() function\n"; 52$p1 = new Xml_Parser(); 53$p1->parse($xml); 54echo "Done\n"; 55?> 56--EXPECT-- 57Simple test of xml_set_notation_decl_handler(() function 58notation_decl_handler called 59...Name=USDATE 60...Base= 61...System ID=http://www.schema.net/usdate.not 62...Public ID= 63notation_decl_handler called 64...Name=AUSDATE 65...Base= 66...System ID=http://www.schema.net/ausdate.not 67...Public ID= 68notation_decl_handler called 69...Name=ISODATE 70...Base= 71...System ID=http://www.schema.net/isodate.not 72...Public ID= 73unparsed_entity_decl_handler called 74...Entity name=testUS 75...Base= 76...System ID=test_usdate.xml 77...Public ID= 78...Notation name=USDATE 79unparsed_entity_decl_handler called 80...Entity name=testAUS 81...Base= 82...System ID=test_ausdate.xml 83...Public ID= 84...Notation name=AUSDATE 85unparsed_entity_decl_handler called 86...Entity name=testISO 87...Base= 88...System ID=test_isodate_xml 89...Public ID= 90...Notation name=ISODATE 91Done 92