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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.