Unicode C
Unicode C
Load MIME from XML
See more MIME Examples
Demonstrates the Chilkat Mime.LoadXml method, which reconstructs a MIME tree from Chilkat's MIME XML. The only argument is the XML string.
Background: Chilkat can represent a MIME tree as XML — headers as elements, parameters as attributes — which is convenient for inspecting or editing structure with XML tools. This is the inverse of
GetXml: it rebuilds the full MIME object from that representation. Invalid XML leaves the current object unchanged.Chilkat Unicode C Downloads
#include <C_CkMimeW.h>
void ChilkatSample(void)
{
BOOL success;
HCkMimeW mime;
const wchar_t *xmlText;
success = FALSE;
// Demonstrates the Mime.LoadXml method, which reconstructs a MIME tree from Chilkat's MIME XML.
// The only argument is the XML string.
mime = CkMimeW_Create();
// Chilkat MIME XML (as produced by GetXml).
xmlText = L"<mime><contentType>text/plain</contentType><body>Hello.</body></mime>";
success = CkMimeW_LoadXml(mime,xmlText);
if (success == FALSE) {
wprintf(L"%s\n",CkMimeW_lastErrorText(mime));
CkMimeW_Dispose(mime);
return;
}
wprintf(L"Content-Type: %s\n",CkMimeW_contentType(mime));
CkMimeW_Dispose(mime);
}