Lua
Lua
Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xmlChilkat Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat HTTP API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
local sbXml = chilkat.StringBuilder.new()
-- Download the XML from the URL into sbXml
local success = http:quick_get_sb("https://www.chilkatsoft.com/hamlet.xml", sbXml)
if not success then
print(http.last_error_text)
return
end
local xml = chilkat.Xml.new()
-- Load the XML contained in sbXml
success = xml:load_sb(sbXml, true)
if not success then
print(xml.last_error_text)
return
end
print("Success.")