Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: XML::LibXML Issue

by runrig (Abbot)
on Aug 16, 2013 at 16:29 UTC ( #1049759=note: print w/ replies, xml ) Need Help??


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; }


Comment on Re: XML::LibXML Issue
Download Code
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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049759]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2014-09-02 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (21 votes), past polls