Annotation of embedaddon/php/ext/simplexml/tests/profile12.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SimpleXML [profile]: Accessing namespaced root and non namespaced children
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("simplexml")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $xml =<<<EOF
! 9: <?xml version="1.0" encoding="utf-8"?>
! 10: <soap:Envelope
! 11: xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
! 12: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
! 13: xmlns:xsd="http://www.w3.org/2001/XMLSchema"
! 14: >
! 15: <soap:Body>
! 16: <businessList foo="bar">
! 17: <businessInfo businessKey="bla"/>
! 18: </businessList>
! 19: </soap:Body>
! 20: </soap:Envelope>
! 21: EOF;
! 22:
! 23: $sxe = simplexml_load_string($xml);
! 24: $nsl = $sxe->getNamespaces();
! 25: var_dump($nsl);
! 26:
! 27: $sxe = simplexml_load_string($xml, NULL, 0, $nsl['soap']);
! 28: var_dump($sxe->Body);
! 29: var_dump($sxe->Body->children(''));
! 30: var_dump($sxe->Body->children('')->businessList);
! 31:
! 32: ?>
! 33: ===DONE===
! 34: --EXPECTF--
! 35: array(1) {
! 36: ["soap"]=>
! 37: string(41) "http://schemas.xmlsoap.org/soap/envelope/"
! 38: }
! 39: object(SimpleXMLElement)#%s (0) {
! 40: }
! 41: object(SimpleXMLElement)#%s (1) {
! 42: ["businessList"]=>
! 43: object(SimpleXMLElement)#%s (2) {
! 44: ["@attributes"]=>
! 45: array(1) {
! 46: ["foo"]=>
! 47: string(3) "bar"
! 48: }
! 49: ["businessInfo"]=>
! 50: object(SimpleXMLElement)#%s (1) {
! 51: ["@attributes"]=>
! 52: array(1) {
! 53: ["businessKey"]=>
! 54: string(3) "bla"
! 55: }
! 56: }
! 57: }
! 58: }
! 59: object(SimpleXMLElement)#%s (2) {
! 60: ["@attributes"]=>
! 61: array(1) {
! 62: ["foo"]=>
! 63: string(3) "bar"
! 64: }
! 65: ["businessInfo"]=>
! 66: object(SimpleXMLElement)#%s (1) {
! 67: ["@attributes"]=>
! 68: array(1) {
! 69: ["businessKey"]=>
! 70: string(3) "bla"
! 71: }
! 72: }
! 73: }
! 74: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>