Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Convert HTML File to XML File
See more HTML-to-XML/Text Examples
Convert HTML file to XML file.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.HtmlToXml;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
htmlToXml: THtmlToXml;
begin
success := False;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
htmlToXml := THtmlToXml.Create;
// Indicate the charset of the output XML we'll want.
htmlToXml.XmlCharset := 'utf-8';
success := htmlToXml.ConvertFile('test.html','out.xml');
if (success <> True) then
begin
WriteLn(htmlToXml.LastErrorText);
end
else
begin
WriteLn('Success');
end;
htmlToXml.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.