(Delphi DLL) 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, Xml;
...
procedure TForm1.Button1Click(Sender: TObject);
var
xml: HCkXml;
success: Boolean;
strDecoded: PWideChar;
begin
// Load an XML file containing the following:
// <?xml version="1.0" encoding="UTF-8"?>
// <output>Französische</output>
xml := CkXml_Create();
success := CkXml_LoadXmlFile(xml,'qa_data/xml/hasHtmlEntity.xml');
// Get non-decoded content, then get decoded content.
// Result is Französische
Memo1.Lines.Add(CkXml__content(xml));
// Result is Französische
strDecoded := CkXml__decodeEntities(xml,CkXml__content(xml));
Memo1.Lines.Add(strDecoded);
CkXml_Dispose(xml);
end;
|