Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

Saving and Retrieving Data in XML

Saving and retrieving data in XML.

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 9.0 / x64

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

#include <CkXml.h>
#include <CkEmail.h>
#include <CkString.h>

void ChilkatSample(void)
    {

    //  Create an XML file with data that will later be loaded and
    //  accessed by field name:
    CkXml xml;
    xml.put_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) {
        printf("%s\n",xml.lastErrorText());
        return;
    }

    CkXml xml2;

    //  Load the XML file:
    success = xml2.LoadXmlFile("emailData.xml");
    if (success != true) {
        printf("%s\n",xml2.lastErrorText());
        return;
    }

    //  Access the data by name
    printf("%s\n",xml2.getChildContent("from"));
    printf("%s\n",xml2.getChildContent("toName"));
    printf("%s\n",xml2.getChildContent("toAddr"));
    printf("%s\n",xml2.getChildContent("subject"));
    printf("%s\n",xml2.getChildContent("body"));
    printf("------\n");

    //  Let's say I want to load this into an email object:
    CkEmail email;

    email.put_From(xml2.getChildContent("from"));
    CkString toName;
    CkString toAddr;
    toName = xml2.getChildContent("toName");
    toAddr = xml2.getChildContent("toAddr");
    email.AddTo(toName,toAddr);
    email.put_Subject(xml2.getChildContent("subject"));
    email.put_Body(xml2.getChildContent("body"));

    printf("%s\n",email.getMime());


    }

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

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

Mail Component · .NET Mail Component · XML Parser