Accessing XmlDecl in an XML message

Use correlation names to access each XML syntax element in XmlDecl.

These names refer to the elements in input messages, and to elements, attributes, and values that have been set in output messages.

The following table defines the valid correlation names.

Syntax element Correlation name
XmlDecl (XML.XmlDecl)
Version (XML.Version)
Encoding (XML."Encoding")
Standalone (XML.Standalone)

(XML."Encoding") must include quotes, because Encoding is a reserved word.

If you want to refer to the attributes of the XML declaration in an input message, code the following ESQL. These statements are valid for a Compute node; if you are coding for a Database or Filter node, substitute Root for InputRoot.
IF InputRoot.XML.(XML.XmlDecl)* IS NULL THEN
   -- more ESQL --

IF InputRoot.XML.(XML.XmlDecl)*.(XML.Version)* = '1.0' THEN 
   -- more ESQL --

IF InputRoot.XML.(XML.XmlDecl)*.(XML."Encoding")* = 'UTF-8' THEN
   -- more ESQL --

IF InputRoot.XML.(XML.XmlDecl)*.(XML.Standalone)* = 'no' THEN
   -- more ESQL --
If you want to set the XML declaration in an output message in a Compute node, code the following ESQL:
-- Create an XML Declaration
SET OutputRoot.XML.(XML.XmlDecl) = '';

-- Set the Version within the XML Declaration
SET OutputRoot.XML.(XML.XmlDecl).(XML.Version) = '1.0';

-- Set the Encoding within the XML Declaration
SET OutputRoot.XML.(XML.XmlDecl).(XML."Encoding") = 'UTF-8';

-- Set Standalone within the XML Declaration
SET OutputRoot.XML.(XML.XmlDecl).(XML.Standalone) = 'no';  

This ESQL code generates the following XML declaration:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Related concepts
Message flows overview
ESQL overview
Message modeling
Related tasks
Designing a message flow
Defining message flow content
Managing ESQL files
Related reference
The XML declaration
Compute node
Database node
Filter node
ESQL reference
IF statement
SET statement
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2009Copyright IBM Corporation 1999, 2009.
Last updated : 2009-01-07 15:20:23

ac17300_