Visual C++ Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# WinRTDelphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET WinRTVBScript

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

 

 

 

 

 

 

 

 

(C++) XML Sort by Tag

Demonstrates the SortByTag method.

The input XML, available at http://www.chilkatsoft.com/data/fruitSort1.xml, is this:

<root>
    <fruits>
        <apple>
            <fuji>blah</fuji>
            <gala>blah</gala>
            <grannySmith>blah</grannySmith>
            <honeycrisp>blah</honeycrisp>
            <mcIntosh>blah</mcIntosh>
        </apple>
        <banana>blah</banana>
        <blackberry>blah</blackberry>
        <blueberry>blah</blueberry>
        <orange>blah</orange>
        <pear>blah</pear>
    </fruits>
</root>

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>

void ChilkatSample(void)
    {
    CkXml xml;
    CkXml *xSortRoot = 0;

    bool success;
    //  The sample input XML is available at http://www.chilkatsoft.com/data/fruitSort1.xml
    success = xml.LoadXmlFile("fruitSort1.xml");
    if (success != true) {
        printf("%s\n",xml.lastErrorText());
        return;
    }

    //  Sort the direct children under the "fruits" node by tag:
    xSortRoot = xml.FindChild("fruits");

    //  Sort in ascending order.
    bool bAscending;
    bAscending = true;
    xSortRoot->SortByTag(bAscending);

    //  Show the result:
    printf("%s\n",xml.getXml());

    //  
<root>
    <fruits>
        <apple>
            <grannySmith>blah</grannySmith>
            <gala>blah</gala>
            <fuji>blah</fuji>
            <mcIntosh>blah</mcIntosh>
            <honeycrisp>blah</honeycrisp>
        </apple>
        <banana>blah</banana>
        <blackberry>blah</blackberry>
        <blueberry>blah</blueberry>
        <orange>blah</orange>
        <pear>blah</pear>
    </fruits>
</root>
// Sort the direct children under the "apple" node: xSortRoot->FindChild2("apple"); xSortRoot->SortByTag(bAscending); printf("%s\n",xml.getXml()); //
<root>
    <fruits>
        <apple>
            <fuji>blah</fuji>
            <gala>blah</gala>
            <grannySmith>blah</grannySmith>
            <honeycrisp>blah</honeycrisp>
            <mcIntosh>blah</mcIntosh>
        </apple>
        <banana>blah</banana>
        <blackberry>blah</blackberry>
        <blueberry>blah</blueberry>
        <orange>blah</orange>
        <pear>blah</pear>
    </fruits>
</root>
delete xSortRoot; }

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