Jump to content

accessing simplexml elements


frobak

Recommended Posts

Hi, i'm trying to access parts of this soap response xml, but I just cant get it. I dont understand the diffgram bit for a start. And do i need to think about the soap and  vehicle_getvehicleandcomponentpartsresponse namespaces?

 

I need the partnumber!

 

Heres the xml

<soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:body>
<vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/">
<vehicle_getvehicleandcomponentpartsresult>
<xs:schema id="NewDataSet" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="">
<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<newdataset xmlns="">
<stddata msdata:roworder="0" diffgr:id="StdData1">
<enhanceddata msdata:roworder="0" diffgr:id="EnhancedData1">
<parts msdata:roworder="0" diffgr:id="Parts1">
<imagepath>http://topcat.adsapplications.co.uk/ImageStore/no_image.png</imagepath>
<supplierid>1992</supplierid>
<supplier>UK Reference</supplier>
<partnumber>202</partnumber>

 

I'm using curl, and the php code im trying:

$result = curl_exec($ch);
$enhanced_data = new SimpleXMLElement($result);
$bat_part = $enhanced_data->children('diffgr', true)->children()->NewDataSet->Parts->partumber;

 

I know this is wrong, but i have accessed similar data from a similar service, the only difference is the below soap response:

<soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:body>
<vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/">
<vehicle_getvehicleandcomponentpartsresult>

 

Surely this shouldnt be so difficult, am i doing somethign completely wrong?

Link to comment
https://forums.phpfreaks.com/topic/267066-accessing-simplexml-elements/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.