profile13.phpt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. SimpleXML [profile]: Accessing by namespace prefix
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $xml =<<<EOF
  8. <?xml version="1.0" encoding="utf-8"?>
  9. <soap:Envelope
  10. xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  11. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  12. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  13. >
  14. <soap:Body>
  15. <businessList foo="bar">
  16. <businessInfo businessKey="bla"/>
  17. </businessList>
  18. </soap:Body>
  19. </soap:Envelope>
  20. EOF;
  21. $sxe = simplexml_load_string($xml);
  22. var_dump($sxe->children('soap', 1));
  23. $sxe = simplexml_load_string($xml, NULL, 0, 'soap', 1);
  24. var_dump($sxe->Body);
  25. var_dump($sxe->Body->children(''));
  26. var_dump($sxe->Body->children('')->businessList);
  27. ?>
  28. --EXPECTF--
  29. object(SimpleXMLElement)#%d (1) {
  30. ["Body"]=>
  31. object(SimpleXMLElement)#%d (0) {
  32. }
  33. }
  34. object(SimpleXMLElement)#%d (0) {
  35. }
  36. object(SimpleXMLElement)#%d (1) {
  37. ["businessList"]=>
  38. object(SimpleXMLElement)#%d (2) {
  39. ["@attributes"]=>
  40. array(1) {
  41. ["foo"]=>
  42. string(3) "bar"
  43. }
  44. ["businessInfo"]=>
  45. object(SimpleXMLElement)#%d (1) {
  46. ["@attributes"]=>
  47. array(1) {
  48. ["businessKey"]=>
  49. string(3) "bla"
  50. }
  51. }
  52. }
  53. }
  54. object(SimpleXMLElement)#%d (2) {
  55. ["@attributes"]=>
  56. array(1) {
  57. ["foo"]=>
  58. string(3) "bar"
  59. }
  60. ["businessInfo"]=>
  61. object(SimpleXMLElement)#%d (1) {
  62. ["@attributes"]=>
  63. array(1) {
  64. ["businessKey"]=>
  65. string(3) "bla"
  66. }
  67. }
  68. }