Sample code for 30+ languages & platforms
Delphi DLL

Download HTML from URL and Convert to XML

See more HTML-to-XML/Text Examples

Downloads an HTML page from a URL and converts it to XML.

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Global, HtmlToXml, Http;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
glob: HCkGlobal;
http: HCkHttp;
html: PWideChar;
htmlToXml: HCkHtmlToXml;
xml: PWideChar;

begin
success := False;

// Note: This example requires the Chilkat Bundle license.

// Any string argument automatically begins the 30-day trial.
glob := CkGlobal_Create();
success := CkGlobal_UnlockBundle(glob,'30-day trial');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkGlobal__lastErrorText(glob));
    Exit;
  end;

http := CkHttp_Create();

html := CkHttp__quickGetStr(http,'http://www.intel.com/');
if (CkHttp_getLastMethodSuccess(http) <> True) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

htmlToXml := CkHtmlToXml_Create();

// Indicate the charset of the output XML we'll want.
CkHtmlToXml_putXmlCharset(htmlToXml,'utf-8');

// Set the HTML:
CkHtmlToXml_putHtml(htmlToXml,html);

// Convert to XML:

xml := CkHtmlToXml__toXml(htmlToXml);

// Save the XML to a file.
// Make sure your charset here matches the charset
// used for the XmlCharset property.
success := CkHtmlToXml_WriteStringToFile(htmlToXml,xml,'qa_output/out.xml','utf-8');

Memo1.Lines.Add('Finished.');

CkGlobal_Dispose(glob);
CkHttp_Dispose(http);
CkHtmlToXml_Dispose(htmlToXml);

end;