~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to ext/xml/tests/xml009.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

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