Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Mime
string ls_XmlText

li_Success = 0

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

loo_Mime = create oleobject
li_rc = loo_Mime.ConnectToNewObject("Chilkat.Mime")
if li_rc < 0 then
    destroy loo_Mime
    MessageBox("Error","Connecting to COM object failed")
    return
end if

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

li_Success = loo_Mime.LoadXml(ls_XmlText)
if li_Success = 0 then
    Write-Debug loo_Mime.LastErrorText
    destroy loo_Mime
    return
end if

Write-Debug "Content-Type: " + loo_Mime.ContentType


destroy loo_Mime