Man ... I normally manage to get XML::Simple working fine on XML feeds.. but this one I just can't figure out :(
The structure is as follows;
<products>
<product>
<name><![CDATA[OLYMPUS MJU 410 ZOOM DIGITAL CAMERA]]></name>
<description><![CDATA[ OLYMPUS MJU 410 ZOOM DIGITAL CAMERA ]]></description>
<imageUrl><![CDATA[ http://www.site.com/images/products/t_OLYMJUD410Z.gif]]></imageUrl>
<productUrl><![CDATA[http://www.site.com/click?a=322582&p=17211&prod=5908504]]></productUrl>
<price>279.9</price>
<currency>GBP</currency>
<TDProductId>5908504</TDProductId>
<TDCategories>
<TDCategory>
<name><![CDATA[Digital Compact Cameras]]></name>
</TDCategory>
</TDCategories>
<fields></fields>
</product>
<product>
<name><![CDATA[OLYMPUS MJU 410 ZOOM DIGITAL CAMERA]]></name>
<description><![CDATA[ OLYMPUS MJU 410 ZOOM DIGITAL CAMERA ]]></description>
<imageUrl><![CDATA[ http://www.site.com/images/products/t_OLYMJUD410Z.gif]]></imageUrl>
<productUrl><![CDATA[http://www.site.com/click?a=322582&p=17211&prod=5908504]]></productUrl>
<price>279.9</price>
<currency>GBP</currency>
<TDProductId>5908504</TDProductId>
<TDCategories>
<TDCategory>
<name><![CDATA[Digital Compact Cameras]]></name>
</TDCategory>
</TDCategories>
<fields></fields>
</product>
</products>
I've tried so many ways.. but none of them yeild a value :(
print "TEST: " . $ref->{products}->{product}->{name}->[0];
print "TEST: " . $ref->{products}->[0]->{product}->{name};
print "TEST: " . $ref->{products}->{product}[0]->{name};
...etc
Even this gives no results;
Am I just being really stupid, and missing something simple? This is sending me mad
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
The structure is as follows;
Code:
<?xml version="1.0" encoding="UTF-8"?> <products>
<product>
<name><![CDATA[OLYMPUS MJU 410 ZOOM DIGITAL CAMERA]]></name>
<description><![CDATA[ OLYMPUS MJU 410 ZOOM DIGITAL CAMERA ]]></description>
<imageUrl><![CDATA[ http://www.site.com/images/products/t_OLYMJUD410Z.gif]]></imageUrl>
<productUrl><![CDATA[http://www.site.com/click?a=322582&p=17211&prod=5908504]]></productUrl>
<price>279.9</price>
<currency>GBP</currency>
<TDProductId>5908504</TDProductId>
<TDCategories>
<TDCategory>
<name><![CDATA[Digital Compact Cameras]]></name>
</TDCategory>
</TDCategories>
<fields></fields>
</product>
<product>
<name><![CDATA[OLYMPUS MJU 410 ZOOM DIGITAL CAMERA]]></name>
<description><![CDATA[ OLYMPUS MJU 410 ZOOM DIGITAL CAMERA ]]></description>
<imageUrl><![CDATA[ http://www.site.com/images/products/t_OLYMJUD410Z.gif]]></imageUrl>
<productUrl><![CDATA[http://www.site.com/click?a=322582&p=17211&prod=5908504]]></productUrl>
<price>279.9</price>
<currency>GBP</currency>
<TDProductId>5908504</TDProductId>
<TDCategories>
<TDCategory>
<name><![CDATA[Digital Compact Cameras]]></name>
</TDCategory>
</TDCategories>
<fields></fields>
</product>
</products>
I've tried so many ways.. but none of them yeild a value :(
Code:
my $ref = XMLin($xml); print "TEST: " . $ref->{products}->{product}->{name}->[0];
print "TEST: " . $ref->{products}->[0]->{product}->{name};
print "TEST: " . $ref->{products}->{product}[0]->{name};
...etc
Even this gives no results;
Code:
Dumper($ref->{products})Quote:
TEST: $VAR1 = undef;Am I just being really stupid, and missing something simple? This is sending me mad

Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!