C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C# Examples

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


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

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Saving and Retrieving Data in XML

Saving and retrieving data in XML.

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

//  Create an XML file with data that will later be loaded and
//  accessed by field name:
Chilkat.Xml xml = new Chilkat.Xml();
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:
bool success;
success = xml.SaveXml("emailData.xml");
if (success != true) {
    MessageBox.Show(xml.LastErrorText);
    return;
}

Chilkat.Xml xml2 = new Chilkat.Xml();

//  Load the XML file:
success = xml2.LoadXmlFile("emailData.xml");
if (success != true) {
    MessageBox.Show(xml2.LastErrorText);
    return;
}

//  Access the data by name
textBox1.Text += xml2.GetChildContent("from") + "\r\n";
textBox1.Text += xml2.GetChildContent("toName") + "\r\n";
textBox1.Text += xml2.GetChildContent("toAddr") + "\r\n";
textBox1.Text += xml2.GetChildContent("subject") + "\r\n";
textBox1.Text += xml2.GetChildContent("body") + "\r\n";
textBox1.Text += "------" + "\r\n";

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

email.From = xml2.GetChildContent("from");
string toName;
string toAddr;
toName = xml2.GetChildContent("toName");
toAddr = xml2.GetChildContent("toAddr");
email.AddTo(toName,toAddr);
email.Subject = xml2.GetChildContent("subject");
email.Body = xml2.GetChildContent("body");

textBox1.Text += email.GetMime() + "\r\n";


 

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

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

Email Component · XML Parser