in reply to XML::LibXML Parser Error

The previous thread includes good discussion of why your initial HTTP request may fail. Are you testing the response codes or content yet?

Replies are listed 'Best First'.
Re^2: XML::LibXML Parser Error
by omegaweaponZ (Beadle) on Mar 07, 2014 at 16:38 UTC
    Yes, this still is experiencing the same issue, hence a fresh thread. I have tried to eval of the parser and this does not seem to make any difference. Attempting multiple times will occasionally work, but it can still work on the first try or fail after the 10th try. I need some other discussions on what else can be attempted and if this may be a common issue with a common solution. Has anyone else run into this issue before?

      Failure of HTTP requests hasn't been new since 1991 ;-) so test the response:

      use LWP; my $url = 'http://feeds.feedburner.com/oreilly/perl?format=xml'; my $agent = LWP::UserAgent->new; my $request = HTTP::Request->new(GET => $url); $request->content_type('application/xml'); my $response = $agent->request($request); if ($response->is_success) { print "HTTP response is good\n"; # Parse XML here } else { die "Awooga! HTTP request failed with ". $response->status_line; }
        I understand that. But it isn't failing the HTTP response...Output:
        HTTP response is good parser error : Document is empty parser error : Start tag expected, '<' not found
        The XML starts off properly with a <> tag everytime...