Jump to content

Trying to parse xml-rpc using SimpleXML


phpretardn00b

Recommended Posts

N00b alert all so please bear with me.

 

I am trying to parse through a XML document...a XML-rpc response to be exact...the good thing is the code is doing as its told.

 

Here is the XML:

<methodResponse>
<params>
<param>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>secondarysurface</name>
<value><string/></value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>thirdsurface</name>
<value>
<string/>
</value>
</member>

 

And the SimpleXML php:

***$x is simplexml_load_string($result); and $result is the XML above.

foreach($x->params->param->value->array->data->value->struct->member as $member)
  {
echo $member->name."=";
echo $member->value->children()."<br />";
}

 

I see why it doesnt make it to the next Struct, because I am going through all those initial XML tags in my foreach...so how can I parse the first struct as shown above but for the 2nd - nth structs use a different one?

 

Any help will be greatly appreciated.

 

J

Link to comment
https://forums.phpfreaks.com/topic/72519-trying-to-parse-xml-rpc-using-simplexml/
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.