3

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

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Abx
  • 2,852
  • 4
  • 30
  • 50
  • Sounds as if you need to learn the basics of the product first. I recommend watching some introductory videos. After that, import some of the product samples ( there are loads of them ) and look at how they work. – kimbert May 31 '16 at 18:13

1 Answers1

2

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

Abx
  • 2,852
  • 4
  • 30
  • 50
  • 3
    Actually, the first line is not required. It will create a field with name 'Item' under OutputRoot.XMLNSC. But SET statement on the second line will auto-create that field for you. – kimbert Aug 04 '16 at 20:42