010.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. SimpleXML: Simple Inheritance
  3. --EXTENSIONS--
  4. simplexml
  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. --EXPECTF--
  29. object(simplexml_inherited)#%d (2) {
  30. ["@attributes"]=>
  31. array(1) {
  32. ["id"]=>
  33. string(5) "elem1"
  34. }
  35. ["elem1"]=>
  36. object(simplexml_inherited)#%d (3) {
  37. ["@attributes"]=>
  38. array(1) {
  39. ["attr1"]=>
  40. string(5) "first"
  41. }
  42. ["comment"]=>
  43. object(simplexml_inherited)#%d (0) {
  44. }
  45. ["elem2"]=>
  46. object(simplexml_inherited)#%d (1) {
  47. ["elem3"]=>
  48. object(simplexml_inherited)#%d (1) {
  49. ["elem4"]=>
  50. object(simplexml_inherited)#%d (1) {
  51. ["test"]=>
  52. object(simplexml_inherited)#%d (0) {
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }