#50805 [Opn->Bgs]: simplexml_load_string not finding any data
| From: | rrichards@php.net | Date: | Wed, 20 Jan 2010 16:27:14 +0000 |
| Subject: | #50805 [Opn->Bgs]: simplexml_load_string not finding any data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146822@lists.php.net to get a copy of this message | ||
ID: 50805
Updated by: rrichards@php.net
Reported By: okycastro at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: *XML functions
Operating System: windows vista
PHP Version: 5.2.12
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You need to use correct XPath expressions
Previous Comments:
------------------------------------------------------------------------
[2010-01-20 15:45:52] okycastro at gmail dot com
Description:
------------
simplexml_load_string not producing the expected results
Reproduce code:
---------------
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:createBanResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://ws.interfaces.sessions.APILink.amdocs">
<createBanReturn href="#id0" />
</ns1:createBanResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:OutCreateBanInfo"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://io.datainfo.APILink.amdocs">
<ban xsi:type="xsd:int">688666259</ban>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
XML;
$root = simplexml_load_string($xml);
var_dump($root); //EMPTY
$result = $root->xpath("ban");//EMPTY
print_r($result);//EMPTY
Expected result:
----------------
I expected some data from the xml. For example xpath should return
688666259. I use simplexml_load_string many time and never have
problems. I never used it with an xml with so many attributes.
Actual result:
--------------
Array ( ) object(SimpleXMLElement)#1 (0) { }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50805&edit=1