php.net |  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
 [2010-01-20 15:45 UTC] 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) { }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-20 16:27 UTC] rrichards@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC