diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/xml/tests/xml010.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/xml/tests/xml010.phpt')
-rw-r--r-- | ext/xml/tests/xml010.phpt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/xml/tests/xml010.phpt b/ext/xml/tests/xml010.phpt new file mode 100644 index 0000000..e968442 --- /dev/null +++ b/ext/xml/tests/xml010.phpt @@ -0,0 +1,39 @@ +--TEST-- +XML parser test, attributes +--SKIPIF-- +<?php +require_once("skipif.inc"); +if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");} +?> +--FILE-- +<?php +function start_elem($parser,$name,$attribs) { + print "$name "; + + foreach($attribs as $key => $value) { + print "$key = $value "; + } + print "\n"; +} +function end_elem() +{ +} + +$xml = <<<HERE +<a xmlns="http://example.com/foo" + xmlns:bar="http://example.com/bar"> + <bar:b foo="bar"/> + <bar:c bar:nix="null" foo="bar"/> +</a> +HERE; + +$parser = xml_parser_create_ns("ISO-8859-1","@"); +xml_set_element_handler($parser,'start_elem','end_elem'); +xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); +xml_parse($parser, $xml); +xml_parser_free($parser); +?> +--EXPECT-- +http://example.com/foo@a +http://example.com/bar@b foo = bar +http://example.com/bar@c http://example.com/bar@nix = null foo = bar |