Visual C++ Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Delphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVBScript

C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Email Object
Encryption
FTP
HTML Conversion
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...
Amazon S3
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

Saving and Retrieving Data in XML

Saving and retrieving data in XML.

Downloads:

MS Windows Visual C/C++ Libraries
Linux/CentOS C/C++ Libraries
MAC OS X C/C++ Libraries
Solaris C/C++ Libraries
C++ Builder Libraries
FreeBSD C++ Libraries
HP-UX C++ Libraries
BlackBerry QNX C++ Libraries
#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());


    }

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