Sample code for 30+ languages & platforms
Visual FoxPro

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 Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMime
LOCAL lcXmlText

lnSuccess = 0

*  Demonstrates the Mime.LoadXml method, which reconstructs a MIME tree from Chilkat's MIME XML.
*  The only argument is the XML string.

loMime = CreateObject('Chilkat.Mime')

*  Chilkat MIME XML (as produced by GetXml).
lcXmlText = "<mime><contentType>text/plain</contentType><body>Hello.</body></mime>"

lnSuccess = loMime.LoadXml(lcXmlText)
IF (lnSuccess = 0) THEN
    ? loMime.LastErrorText
    RELEASE loMime
    CANCEL
ENDIF

? "Content-Type: " + loMime.ContentType

RELEASE loMime