xref: /PHP-5.4/ext/xml/tests/xml009.phpt (revision 97200944)
1--TEST--
2XML parser test, default namespaces
3--SKIPIF--
4<?php
5require_once("skipif.inc");
6if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
7?>
8--FILE--
9<?php
10function start_elem($parser,$name,$attribs) {
11	var_dump($name);
12}
13function end_elem()
14{
15}
16
17$xml = <<<HERE
18<a xmlns="http://example.com/foo"
19       xmlns:bar="http://example.com/bar"
20	   xmlns:baz="http://example.com/baz">
21  <bar:b />
22  <bar:c xmlns:bar="http://example.com/foo"/>
23</a>
24HERE;
25
26$parser = xml_parser_create_ns("ISO-8859-1","@");
27xml_set_element_handler($parser,'start_elem','end_elem');
28xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
29xml_parse($parser, $xml);
30xml_parser_free($parser);
31?>
32--EXPECT--
33string(24) "http://example.com/foo@a"
34string(24) "http://example.com/bar@b"
35string(24) "http://example.com/foo@c"
36