in reply to XML::Parser and Subs in a sub

Perl doesn't do nested subs, so there's nothing to gain by embedding them inside parse_return_xml. In fact, it probably makes it harder to understand and maintain in the long run.

As for the error, that's from expat itself saying that your XML isn't well formed. Try prepending an ?xml? declaration to your input (if it's not already there) and see if that fixes things.