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

« back to all changes in this revision

Viewing changes to ext/xml/tests/xml010.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, attributes
 
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
        print "$name ";
 
11
    
 
12
    foreach($attribs as $key => $value) {
 
13
        print "$key = $value ";
 
14
    }
 
15
    print "\n";
 
16
}
 
17
function end_elem()
 
18
{
 
19
}
 
20
 
 
21
$xml = <<<HERE
 
22
<a xmlns="http://example.com/foo"
 
23
    xmlns:bar="http://example.com/bar">
 
24
  <bar:b foo="bar"/>
 
25
  <bar:c bar:nix="null" foo="bar"/>
 
26
</a>
 
27
HERE;
 
28
 
 
29
$parser = xml_parser_create_ns("ISO-8859-1","@");
 
30
xml_set_element_handler($parser,'start_elem','end_elem');
 
31
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
 
32
xml_parse($parser, $xml);
 
33
xml_parser_free($parser);
 
34
?>
 
35
--EXPECT--
 
36
http://example.com/foo@a 
 
37
http://example.com/bar@b foo = bar 
 
38
http://example.com/bar@c http://example.com/bar@nix = null foo = bar