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


in reply to XML::LibXML Issue

Perhaps http occasionally fails to fetch content? What you might want to do is eval in a loop (add some limit to the loop at your discretion):
my $dom; while (1) { $dom = eval{ XML::LibXML->load_xml(location => $xmlurl) }; last if $dom; print "Error getting xml-will retry: $@\n"; sleep 5; }

Replies are listed 'Best First'.
Re^2: XML::LibXML Issue
by omegaweaponZ (Beadle) on Aug 16, 2013 at 20:09 UTC
    Interesting suggestion. It is possible the page has not executed the xml entirely yet and the parser jumps the gun attempting to parse

      It is possible the page has not executed the xml entirely yet and the parser jumps the gun attempting to parse

      No. Incomplete download (http response) can happen, but its very doubtful that libxml jumps the gun at any point and causes the apperance of incomplete download

        So what happens is I can re-try to load the xml if under a count of lets say 5, it either will work on the first try, fail all 5 times, or work sometime within the 5 times. So this isn't exactly a "solution" of sorts. Are there any other ideas that might help or have others seen this before with xml parsers?