Sample code for 30+ languages & platforms
Objective-C

Load XML from a Remote URL

Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <CkoStringBuilder.h>
#import <CkoXml.h>

BOOL success = NO;

//  This example assumes the Chilkat HTTP API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

CkoHttp *http = [[CkoHttp alloc] init];
CkoStringBuilder *sbXml = [[CkoStringBuilder alloc] init];

//  Download the XML from the URL into sbXml
success = [http QuickGetSb: @"https://www.chilkatsoft.com/hamlet.xml" sbContent: sbXml];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

CkoXml *xml = [[CkoXml alloc] init];

//  Load the XML contained in sbXml
success = [xml LoadSb: sbXml autoTrim: YES];
if (success == NO) {
    NSLog(@"%@",xml.LastErrorText);
    return;
}

NSLog(@"%@",@"Success.");