Skip to content

qie.createXMLMessage

Signature: qie.createXMLMessage(template, encoding*)

Returns: XML Message message - the newly created message object

Replace the current message with an empty XML formatted message based on the XML template.

Note

You must specify at least the root node (and only 1 root node) in your XML template in order to create a valid XML message.

Note

The return value MUST ALWAYS be assigned to the bound-in message object.

Parameters

Type Name Description Default
String template the XML document template
String encoding* (optional) the character encoding for this message Source Node encoding

Example

// Example: create an XML message from a template.
// Note: the XML prolog cannot be specified in the template itself.

var xmlTemplate = `
<greeting>
    <message>Hello, world!</message>
    <language>English</language>
</greeting>
`;

message = qie.createXMLMessage(
    xmlTemplate,   // template: XML document template (single root node required)
    'UTF-8'        // encoding: character encoding
);

// Add the XML prolog after creating the message
message.addProlog('<?xml version="1.0" encoding="UTF-8"?>');