This is the xml that I am returning that I need to parse. The data I need to extract is the attributes 'id' and 'oldID' from CategoryMapping node.
<GetCategoryMappingsResponse
xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2017-05-26T13:51:34.492Z</Timestamp>
<Ack>Success</Ack>
<Version>989</Version>
<Build>E989_CORE_API_18131074_R1</Build>
<CategoryMapping id="183872" oldID="43010"/>
<CategoryMapping id="183322" oldID="20483"/>
<CategoryMapping id="1290" oldID="43014"/>
<CategoryMapping id="183888" oldID="43015"/>
<CategoryMapping id="48718" oldID="43016"/>
<CategoryMapping id="183051" oldID="45064"/>
...
<CategoryMapping id="183174" oldID="83983"/>
<CategoryMapping id="184437" oldID="15"/>
<CategoryMapping id="183185" oldID="83984"/>
<CategoryVersion>117</CategoryVersion>
</GetCategoryMappingsResponse>
This is the perl that I have tried but it is not returning all the data
foreach $key (keys $data->{CategoryMapping}) {
print "($rownum) id=$key ";
my %new_hash = %{$data->{CategoryMapping}{$key}};
foreach $key2 (keys %new_hash) {
print "$key2=$new_hash{$key2}<br/>";
}
}