get-mime-content-type-param

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Expression Functions > MIME Expression Functions >

get-mime-content-type-param

Returns the parameter param from the "Content-Type" header of a stream if such header and parameter exists; otherwise, it returns the value of the default argument. This function can be used to receive messages that follow the optional AS2 profile Multiple Attachments (MA). Namely, it can extract the starting document Content-ID and Content-Type specified as parameters 'start' and 'type' to multipart/related content type. It can also be used to extract the character set, as shown in the example below.

 

Signature

get-mime-content-type-param(s:stream, param:string, default:string="") -> string

 

Parameters

Name

Type

Description

s

stream

Specifies the input stream.

param

string

Specifies the name of the parameter to return.

default

string

Specifies the value to return when the requested param does not exist. By default, this is an empty string.

 

Examples

Assuming that stream msg contains the header Content-Type: text/html; charset=utf-8, the following expression will return "utf-8":

 

mime-get-content-type-param(msg, "charset", "ascii")


© 2019 Altova GmbH