You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
902 B

  1. --TEST--
  2. SimpleXML [profile]: Accessing two elements with the same name, but different namespaces
  3. --SKIPIF--
  4. <?php if (!extension_loaded("simplexml")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. error_reporting(E_ALL & ~E_NOTICE);
  8. $root = simplexml_load_string(b'<?xml version="1.0"?>
  9. <root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
  10. <reserved:child>Hello</reserved:child>
  11. <special:child>World</special:child>
  12. </root>
  13. ');
  14. var_dump($root->children('reserved-ns')->child);
  15. var_dump($root->children('special-ns')->child);
  16. var_dump((string)$root->children('reserved-ns')->child);
  17. var_dump((string)$root->children('special-ns')->child);
  18. var_dump($root->child);
  19. ?>
  20. ===DONE===
  21. --EXPECTF--
  22. object(SimpleXMLElement)#%d (1) {
  23. [0]=>
  24. unicode(5) "Hello"
  25. }
  26. object(SimpleXMLElement)#%d (1) {
  27. [0]=>
  28. unicode(5) "World"
  29. }
  30. unicode(5) "Hello"
  31. unicode(5) "World"
  32. object(SimpleXMLElement)#%d (0) {
  33. }
  34. ===DONE===