010.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --TEST--
  2. SimpleXML: Simple Inheritance
  3. --SKIPIF--
  4. <?php if (!extension_loaded("simplexml")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. class simplexml_inherited extends SimpleXMLElement
  8. {
  9. }
  10. $xml =<<<EOF
  11. <?xml version='1.0'?>
  12. <!DOCTYPE sxe SYSTEM "notfound.dtd">
  13. <sxe id="elem1">
  14. <elem1 attr1='first'>
  15. <!-- comment -->
  16. <elem2>
  17. <elem3>
  18. <elem4>
  19. <?test processing instruction ?>
  20. </elem4>
  21. </elem3>
  22. </elem2>
  23. </elem1>
  24. </sxe>
  25. EOF;
  26. var_dump(simplexml_load_string($xml, 'simplexml_inherited'));
  27. ?>
  28. ===DONE===
  29. --EXPECTF--
  30. object(simplexml_inherited)#%d (2) {
  31. ["@attributes"]=>
  32. array(1) {
  33. ["id"]=>
  34. string(5) "elem1"
  35. }
  36. ["elem1"]=>
  37. object(simplexml_inherited)#%d (3) {
  38. ["@attributes"]=>
  39. array(1) {
  40. ["attr1"]=>
  41. string(5) "first"
  42. }
  43. ["comment"]=>
  44. object(simplexml_inherited)#%d (0) {
  45. }
  46. ["elem2"]=>
  47. object(simplexml_inherited)#%d (1) {
  48. ["elem3"]=>
  49. object(simplexml_inherited)#%d (1) {
  50. ["elem4"]=>
  51. object(simplexml_inherited)#%d (1) {
  52. ["test"]=>
  53. object(simplexml_inherited)#%d (0) {
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. ===DONE===