SOLVED: XML Parsing from URLby jshank (Initiate)
|on Jun 26, 2015 at 15:02 UTC
jshank has asked for the wisdom of the Perl Monks concerning the following question:
SOLVED in the update at the end. I need to parse a continuous XML stream coming from a device via http. The problem I run into is I can't find a way to convince PerlSAX to take a URL as a source. There's no good way to "download" the XML and hand it off to the XML parser because the download is never going to finish (continuous stream).
Update: Based on the great information found here, I did determine that preprocessing the data was required. LWP has the ability to process with a handler. As a really nice side-effect, the LWP handler seems to automatically call the handler for each part of the multpart stream so I don't need to set the read_size_hint. For even better multipart http handling, see Alexander's MultipartFilter.pm module. Below is my working code