note 62238 deleted from function.simplexml-load-string by betz

From: Date: Thu, 23 Feb 2006 13:56:54 +0000
Subject: note 62238 deleted from function.simplexml-load-string by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-104295@lists.php.net to get a copy of this message
Note Submitter: hans at granqvist dot com ---- There seems to be no way of using simplexml if the root element has no default namespace. For example, the following code <?php $a = "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <s:Fault> <s:faultcode>s:Server</s:faultcode> <s:faultstring>Some error description here </s:faultstring> </s:Fault> </s:Body> </s:Envelope>"; $b = "<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'> <Body> <Fault> <faultcode>s:Server</faultcode> <faultstring>Some error description here </faultstring> </Fault> </Body> </Envelope>"; var_dump(simplexml_load_string($a)); var_dump(simplexml_load_string($b)); ?> gives the following output ---- object(SimpleXMLElement)#1 (0) { } object(SimpleXMLElement)#1 (1) { ["Body"]=> object(SimpleXMLElement)#2 (1) { ["Fault"]=> object(SimpleXMLElement)#3 (2) { ["faultcode"]=> string(8) "s:Server" ["faultstring"]=> string(28) "Some error description here " } } } ---- but it should be identical . . . Anyone has some more information on what can be done to get this to work? Thanks, Hans

« previous php.notes (#104295) next »