Swift
Swift
Decode HTML Entities found in XML
Demonstrates how to decode HTML entities found in XML.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
// Load an XML file containing the following:
// <?xml version="1.0" encoding="UTF-8"?>
// <output>Französische</output>
let xml = CkoXml()!
success = xml.loadFile(path: "qa_data/xml/hasHtmlEntity.xml")
// Get non-decoded content, then get decoded content.
// Result is Französische
print("\(xml.content!)")
// Result is Französische
var strDecoded: String? = xml.decodeEntities(str: xml.content)
print("\(strDecoded!)")
}