Sample code for 30+ languages & platforms
Rust

Decode HTML Entities found in XML

Demonstrates how to decode HTML entities found in XML.

Chilkat Rust Downloads

Rust

// Load an XML file containing the following:

// <?xml version="1.0" encoding="UTF-8"?>
// <output>Franz&#xf6;sische</output> 

let xml = chilkat::Xml::new();
let _ = xml.load_xml_file("qa_data/xml/hasHtmlEntity.xml").is_ok();

// Get non-decoded content, then get decoded content.

// Result is Franz&#xf6;sische
println!("{}", xml.content());

// Result is Französische
let str_decoded = xml.decode_entities(&xml.content()).unwrap_or_default();
println!("{}", str_decoded);