cancel
Showing results for 
Search instead for 
Did you mean: 

XML needs starting tag and ending tag without value through PI

0 Kudos

Hi experts,

proxy to file scenario

one field contains no value but FTP wants that field with Starting tag and ending tag.

For ex: "Employee" is a field, In that field is empty.

In xml payload of SXMB_MONI without value is not showing or showing like this 

how can I get these type of xml, kindly help me

Regards

Naveen L

Accepted Solutions (0)

Answers (3)

Answers (3)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Naveen,

                     See this mapping where all items are mapped one to one except item3 which is linked to target field mapwithdefault

Now in test tab I am testing a payload

Source payload


<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_SRC xmlns:ns0="urn:Demo/SCN">

   <Header>

      <Item1>1</Item1>

      <Item2/>

      <Item4>3</Item4>

   </Header>

</ns0:MT_SRC>

In the payload item3 is not present while Item2 is present but there is no field value. After mapping the xml generated is


<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_TGT xmlns:ns0="urn:Demo/SCN">

<Header>

<Item1>1</Item1>

<Item2></Item2>

<Item3></Item3>

<Item4>3</Item4>

</Header></ns0:MT_TGT>

You can see Item3 with empty tag is present in output because you had an empty context inserted via "mapwithdefault".

Regards

Anupam

0 Kudos

Hi Anupam,

I am not getting like that.

while using map with default. I am getting Xml showing <item3/>

kindly suggest me

Regards

Naveen L

former_member186851
Active Contributor
0 Kudos

Hello Naveen,

Map with Default should work Naveen,

Post the mapping rule used?

0 Kudos
former_member186851
Active Contributor
0 Kudos

Hello Naveen,

This will create a node with empty value like below

<Item></Item>.

Ensure you saved your mapping .

0 Kudos

Hi experts,

proxy to file scenario

one field contains no value but FTP wants that field with Starting tag and ending tag.

For ex: "Employee" is a field, In that field is empty.

In xml payload of SXMB_MONI without value, It is showing nothing or showing like this <Employee/>

But we need <Employee></Employee>    (starting tag and closing tag)

how can I get these type of xml, kindly help me

Regards

Naveen L

iaki_vila
Active Contributor
0 Kudos

Hi Lingampally,

Are you using a message mapping?, you can set the occurrence to 1 and to map a constant value with a blank value in the case the employee is not setting in source XML. You can use the standard mapping function CreatIf with the function Exists, if the value is false you map a constant blank, else the value of the source message (IfThen function).

Regards.

0 Kudos

Hi Inaki,

Thanks for your response, still I am getting single closing tag.<Employee/>

But receiver needs opening tag and closing tag (with out value)

<Employee></Employee>

Kindly suggest me.

Regards

Naveen L