http://www.perlmonks.org?node_id=1012955

Murari has asked for the wisdom of the Perl Monks concerning the following question:

I have a complex xml which I need to parse in PERL to output to different format input xml:
<?xml version="1.0" encoding="UTF-8"?> <response> <result name="response" numFound="58582" start="0"> <doc> <str name="body">Have a great time at this park!</str><int name="is_pa +rk_id">317851</int><str name="ss_image_thumb_small"/> <str name="title">Playground</str> </doc> <doc> <str name="body">Have a great time at this park!</str><int name="is_pa +rk_id">317851</int><str name="ss_image_thumb_small"/> <str name="title">Playground</str> </doc> </result> </response>
and the required output format is:
<?xml version="1.0" encoding="iso-8859-1"?> <Feed> <Products> <Product> <Description>Have a great time at this park!</Description><ExternalId> +PF317851</ExternalId><ImageUrl/> <Name>Playground</Name> </Product> <Product> <Description>Have a great time at this park!</Description><ExternalId> +PF317851</ExternalId><ImageUrl/> <Name>Playground</Name> </Product> </Products> </Feed>
<str name="body"> should be treated as description, <int name="is_park_id"> should be treated as <ExternalId> and <str name="title"> should be treated as <Name>. Could you help in formatting the XML to new format?