12.10.2023, 21:48
Fantastic. I came searching for parsing xml thinking I would have to start from scratch but the job has already been done. Thanks!!
For future users, some of the BoM files contain forecasts for multiple locations so you can generalise by changing the start of the function to search location instead of aac
For future users, some of the BoM files contain forecasts for multiple locations so you can generalise by changing the start of the function to search location instead of aac
Code:
-- Product ID from FTP Public Products and wanted location within the BoM file
local bomProduct = "IDV10450"
local location = "Melbourne"
function starttag(p, tag, attrs)
if tag == 'area' and attrs.type == 'location' and attrs.description == location then
-- and later
data = socket.ftp.get("ftp://ftp.bom.gov.au/anon/gen/fwo/"..bomProduct..".xml")