Unicode C++
Unicode C++
Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xmlChilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkStringBuilderW.h>
#include <CkXmlW.h>
void ChilkatSample(void)
{
bool success = false;
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
CkStringBuilderW sbXml;
// Download the XML from the URL into sbXml
success = http.QuickGetSb(L"https://www.chilkatsoft.com/hamlet.xml",sbXml);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
CkXmlW xml;
// Load the XML contained in sbXml
success = xml.LoadSb(sbXml,true);
if (success == false) {
wprintf(L"%s\n",xml.lastErrorText());
return;
}
wprintf(L"Success.\n");
}