I have a XML file in this format and i want to read the data such as product ID and image and want to display it in a page. of you see the following link http://mrprofessional.se/XML/INT.xml you will see the XML file which i want to parse. please help me this case
<ICECAT-interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://data.icecat.biz/xsd/files.index.xsd">
<files.index Generated="20131228001603">
<file path="export/freexml.int/INT/2229.xml" Product_ID="2229" Updated="20131227074205" Quality="ICECAT" Supplier_id="1" Prod_ID="C4844AE" Catid="377" On_Market="1" Model_Name="10" Product_View="223" HighPic="http://images.icecat.biz/img/norm/high/15743_2229-8075.jpg" HighPicSize="58616" HighPicWidth="400" HighPicHeight="400" Date_Added="20051023000000">
<EAN_UPCS>
<EAN_UPC Value="0886985196538"/>
<EAN_UPC Value="0725184755811"/>
<EAN_UPC Value="5051964028635"/>
<EAN_UPC Value="0088698519653"/>
</EAN_UPCS>
<Country_Markets>
<Country_Market Value="NL"/>
<Country_Market Value="BE"/>
<Country_Market Value="GB"/>
<Country_Market Value="DE"/>
<Country_Market Value="DK"/>
<Country_Market Value="ES"/>
</Country_Markets>
</file>
I want to read the product id and image for which i tried that code
<?php
$xml = simplexml_load_file("INT.xml");
$doc = new DOMDocument();
$doc->$xml;
$ie = $doc->getElementsByTagName( "ICECAT-interface" );
$iedata = $file->item(0)->nodeValue;
echo $iedata;
$file = $doc->getElementsByTagName( "file" );
foreach( $file as $filedata )
{
$p_id = $filedata->getAttribute('Product_ID');
$highpic = $location->getAttribute('HighPic');
echo $$p_id.'-'.$highpic.'<br>';
}
?>
but it s not working please help me on this case
echo $$p_idwhen you're not doing any assignment what so ever