shaunster
10-12-2004, 05:28 AM
Quick question: trying to migrate from AWS3 to AWS4 using Obrien's script. Everything is is more less coming together except one blasted problem...
How do you parse child elements from a root element in the XML?
Example AWS3 XML:
<ImageUrlSmall>
Example AWS3 PHP Parsing:
elseif($d_ar[$j]['tag'] == 'SmallImageUrl') {$SmallImageUrl = $d_ar[$j]['value'];}
then Display the image AWS3:
<a href="product.php4?ASIN=<?=$ASIN"<?=$ImageUrlSmall?>" style="float: left; margin-right: 20px;" border="0" alt="" /><URL></a>
AWS4 XML
<SmallImage>
<URL>
<Height>
<Width>
<MediumImage>
<URL>
<Height>
<Width>
Example AWS4 PHP Parsing:
// This is where I am Stuck;
elseif($d_ar[$j]['tag'] == 'SmallImage') {$SmallImage = $d_ar[$j]['value'];}
elseif($d_ar[$j]['tag'] == 'URL') {$URL = $d_ar[$j]['value'];}
then Display the image AWS4:
<a href="product.php4?ASIN=<?=$ASIN"<?=$URL?>" style="float: left; margin-right: 20px;" border="0" alt="" /><URL></a>
Obviously you can not populate Height & Width with an empty string (?), but I cannot seem to grasp how to get the Child elements from the root element. I am assuming this would be an array?
Would anyone be able to help me with an example..
How do you parse child elements from a root element in the XML?
Example AWS3 XML:
<ImageUrlSmall>
Example AWS3 PHP Parsing:
elseif($d_ar[$j]['tag'] == 'SmallImageUrl') {$SmallImageUrl = $d_ar[$j]['value'];}
then Display the image AWS3:
<a href="product.php4?ASIN=<?=$ASIN"<?=$ImageUrlSmall?>" style="float: left; margin-right: 20px;" border="0" alt="" /><URL></a>
AWS4 XML
<SmallImage>
<URL>
<Height>
<Width>
<MediumImage>
<URL>
<Height>
<Width>
Example AWS4 PHP Parsing:
// This is where I am Stuck;
elseif($d_ar[$j]['tag'] == 'SmallImage') {$SmallImage = $d_ar[$j]['value'];}
elseif($d_ar[$j]['tag'] == 'URL') {$URL = $d_ar[$j]['value'];}
then Display the image AWS4:
<a href="product.php4?ASIN=<?=$ASIN"<?=$URL?>" style="float: left; margin-right: 20px;" border="0" alt="" /><URL></a>
Obviously you can not populate Height & Width with an empty string (?), but I cannot seem to grasp how to get the Child elements from the root element. I am assuming this would be an array?
Would anyone be able to help me with an example..