xml009.phpt 861 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. XML parser test, default namespaces
  3. --SKIPIF--
  4. <?php
  5. require_once("skipif.inc");
  6. if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
  7. ?>
  8. --FILE--
  9. <?php
  10. function start_elem($parser,$name,$attribs) {
  11. var_dump($name);
  12. }
  13. function end_elem()
  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. $parser = xml_parser_create_ns("ISO-8859-1","@");
  25. xml_set_element_handler($parser,'start_elem','end_elem');
  26. xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
  27. xml_parse($parser, $xml);
  28. xml_parser_free($parser);
  29. ?>
  30. --EXPECT--
  31. string(24) "http://example.com/foo@a"
  32. string(24) "http://example.com/bar@b"
  33. string(24) "http://example.com/foo@c"