In PHP to find the value of a xml node whose slibing has a specific value.

Saturday, July 5, 2014

I have an xml file and it contains the following lines.



<myphotos_grid grid="true"><![CDATA[<rows>
<row rowID="1">
<rowAttribute>
<theName>photo-name</theName>
<value/>
</rowAttribute>
<rowAttribute>
<theName>photo-credit</theName>
<value/>
</rowAttribute>
<rowAttribute>
<theName>photo</theName>
<value>
<attachment id="1009343343"/>
</value>
</rowAttribute>
</row>
<row rowID="2">
<rowAttribute>
<theName>photo-name</theName>
<value/>
</rowAttribute>
<rowAttribute>
<theName>photo-credit</theName>
<value/>
</rowAttribute>
<rowAttribute>
<theName>photo</theName>
<value>
<attachment id="4432434344"/>
</value>
</rowAttribute>
</row>
</rows>]]></myphotos_grid>


I am reading xml node values through PHP function xpath.I want to get "value" node text value whose "thename" sibling node text value is photo-credit.I want to get the photo credit values.please help me.







http://ift.tt/1rxwNvu