Sample code for 30+ languages & platforms
Rust

Load XML from a Remote URL

Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml

Chilkat Rust Downloads

Rust

// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let http = chilkat::Http::new();
let sb_xml = chilkat::StringBuilder::new();

// Download the XML from the URL into sbXml
if http.quick_get_sb("https://www.chilkatsoft.com/hamlet.xml", &sb_xml).is_err() {
    println!("{}", http.last_error_text());
    return;
}

let xml = chilkat::Xml::new();

// Load the XML contained in sbXml
if xml.load_sb(&sb_xml, true).is_err() {
    println!("{}", xml.last_error_text());
    return;
}

println!("Success.");