Search code examples
messagebrokeribm-integration-busextended-sql

How to create xml in esql


I am trying to create an xml of the below format

<Item Value = '1234'>
     <Value>5678</Value>
</Item>

I got a clue from

DECLARE sp1 NAMESPACE 'http://www.ibm.com/space1';

/* Namespace declaration to associate prefix 'space1' with the namespace */

SET OutputRoot.XMLNS.TestCase.(XML.NamespaceDecl)xmlns:space1 = 'http://www.ibm.com/space1'; 
SET OutputRoot.XMLNS.TestCase.sp1:data1 = 'Hello!';

generates:

<TestCase xmlns:space1="http://www.ibm.com/space1">
<space1:data1>Hello!</space1:data1>
</TestCase>

Any inputs will be really helpful


Solution

  • For those looking for question similar to this.. This is what worked for me

    CREATE LASTCHILD OF OutputRoot.XMLNSC Type XMLNSC.Folder Name 'Item'; 
    
    SET OuputRoot.XMLNSC.Item.(XMLNSC.Attribute)name = '1234';
    

    This generates the <Item Value = '1234'> part