|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50805 simplexml_load_string not finding any data
Submitted: 2010-01-20 15:45 UTC Modified: 2010-01-20 16:27 UTC
From: okycastro at gmail dot com Assigned:
Status: Not a bug Package: *XML functions
PHP Version: 5.2.12 OS: windows vista
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: okycastro at gmail dot com
New email:
PHP Version: OS:


 [2010-01-20 15:45 UTC] okycastro at gmail dot com
simplexml_load_string not producing the expected results

Reproduce code:
  $xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
        <ns1:createBanResponse soapenv:encodingStyle="" xmlns:ns1="http://ws.interfaces.sessions.APILink.amdocs">
            <createBanReturn href="#id0" />
        <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="" xsi:type="ns2:OutCreateBanInfo" xmlns:soapenc="" xmlns:ns2="http://io.datainfo.APILink.amdocs">
            <ban xsi:type="xsd:int">688666259</ban>
    $root = simplexml_load_string($xml);
    var_dump($root); //EMPTY

$result = $root->xpath("ban");//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) { }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-20 16:27 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

You need to use correct XPath expressions
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 04:01:31 2024 UTC