`
<Listings>
<Listing last_update="2017-11-15 06:01:02">
<count>1</count>
<Property_Ref_No>CO-S-1147</Property_Ref_No>
<Ad_Type>Sale</Ad_Type>
<Unit_Type>Office</Unit_Type>
<Tenanted>0</Tenanted>
<Furnished>2</Furnished>
<Unit_Model/>
<Images>
<image>image 1</image>
<image>image 2</image>
<image>image 3</image>
</Images>
</listing>
</Listings>
`
i have used php while loop
$i=0;
while(is_object($finance = $doc->getElementsByTagName("Images")->item($i)))
{
foreach($finance->childNodes as $nodename)
{
if($nodename->nodeName=='image')
{
foreach($nodename->childNodes as $subNodes)
{
echo $subNodes->nodeName." - ".$subNodes->nodeValue."<br><br><br>";
}
}
else
{
echo $nodename->nodeName." - ".$nodename->nodeValue."<br>";
}
}
$i++;
}
this loop gives me the child node value but i also need parent nodes value as well
I want this xml data in php to and show all the parent and child data using loop need help on this please .
thank you.