Jump to content

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

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.