Delphi ActiveX
Delphi ActiveX
Decode HTML Entities found in XML
Demonstrates how to decode HTML entities found in XML.Chilkat Delphi ActiveX Downloads
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
success: Integer;
xml: TChilkatXml;
strDecoded: WideString;
begin
success := 0;
// 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;