Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
Bzip2
LZW
Bz2
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

Saving and Retrieving Data in XML

Saving and retrieving data in XML.

Download Chilkat Email ActiveX

Download Chilkat XML ActiveX

Download Chilkat IMAP ActiveX

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATMAILLib2_TLB,
    CHILKATXMLLib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
xml: CHILKATXMLLib_TLB.IChilkatXml;
success: Integer;
xml2: CHILKATXMLLib_TLB.IChilkatXml;
email: CHILKATMAILLib2_TLB.IChilkatEmail2;
toName: String;
toAddr: String;

begin

//  Create an XML file with data that will later be loaded and
//  accessed by field name:
xml := TChilkatXml.Create(Self).ControlInterface;
xml.Tag := 'emailData';

xml.NewChild2('from','admin@chilkatsoft.com');
xml.NewChild2('toName','Chilkat Support');
xml.NewChild2('toAddr','support@chilkatsoft.com');
xml.NewChild2('subject','This is a test');
xml.NewChild2('body','This is an email body');

//  Save the XML:

success := xml.SaveXml('emailData.xml');
if (success <> 1) then
  begin
    ShowMessage(xml.LastErrorText);

  end;

xml2 := TChilkatXml.Create(Self).ControlInterface;

//  Load the XML file:
success := xml2.LoadXmlFile('emailData.xml');
if (success <> 1) then
  begin
    ShowMessage(xml2.LastErrorText);

  end;
//  Access the data by name
Memo1.Lines.Add(xml2.GetChildContent('from'));
Memo1.Lines.Add(xml2.GetChildContent('toName'));
Memo1.Lines.Add(xml2.GetChildContent('toAddr'));
Memo1.Lines.Add(xml2.GetChildContent('subject'));
Memo1.Lines.Add(xml2.GetChildContent('body'));
Memo1.Lines.Add('------');

//  Let's say I want to load this into an email object:
email := CoChilkatEmail2.Create();

email.From := xml2.GetChildContent('from');

toName := xml2.GetChildContent('toName');
toAddr := xml2.GetChildContent('toAddr');
email.AddTo(toName,toAddr);
email.Subject := xml2.GetChildContent('subject');
email.Body := xml2.GetChildContent('body');

Memo1.Lines.Add(email.GetMime());


end;

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · XML Parser