(Delphi ActiveX) Decode HTML Entities found in XML
Demonstrates how to decode HTML entities found in XML.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
xml: TChilkatXml;
success: Integer;
strDecoded: WideString;
begin
// Load an XML file containing the following:
// <?xml version="1.0" encoding="UTF-8"?>
// <output>Französische</output>
xml := TChilkatXml.Create(Self);
success := xml.LoadXmlFile('qa_data/xml/hasHtmlEntity.xml');
// Get non-decoded content, then get decoded content.
// Result is Französische
Memo1.Lines.Add(xml.Content);
// Result is Französische
strDecoded := xml.DecodeEntities(xml.Content);
Memo1.Lines.Add(strDecoded);
end;
|