cancel
Showing results for 
Search instead for 
Did you mean: 

How to output <field/> instead of <field></field>?

Former Member
0 Kudos

Hi Experts,

When outputting XML files, the file receiver adapter would parse blank or null values like this:

<field></field>.

But a 3rd part system does not support this format(really weird, but it's true), it only supports:

<field/>.

Is there any way to control the file receiver adapter to output blank/null nodes as <field/> but not <field></field>?

Any advice is appreciated, thanks a lot for you your.

Best regards

Luis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Luis,

Does the Sender XML message in XI have the corresponding node? It looks like this node itself is absent, as against the node existing with a blank value.

If this is the case, in the node mapping, you may have to use the 'Exists' function in conjunction with a 'IfWithoutElse' function.

I had same problem with my one scenario, i use IfWithoutElse & compare with null constant.

Then if node is coming null then it won’t come in o/p xml.

Hope this helps,

Regards

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi friends,

I've got a solution for this issue: Use Java Mapping.

In my Java mapping method execute(), I set the property of the output as "Indent". In this case, null nodes will output as <field/>.

This is obviously a poor solution, but it really works. Thanks for all your kind help.

Regards

Luis

Former Member
0 Kudos

Hi Luis,

Interesting. I had used a file receiver which outputs an XML document with blank fields like <field />

Check in the mapping if value exists otherwise try to map it with a constant having blank value

Otherwise try changing the occurence of the element (if you have 1 then change to 0 and check)

Regards,

Arvind

Former Member
0 Kudos

Hi,

Map the nodes with <b>mapwithdefualt</b> and give the default value or some spaces if it is allowed.

Else if the target node is having the occurrences as 0..unbound then exists - createif map to node.

Else if your requirement should give the result as <field/> if the value is not existed then i hope better to go for Java mapping or other or write Adapter module.

to write adapter module see below link.

https://websmp108.sap-ag.de/~sapdownload/011000358700003237612005E/HowToCreateAdapterModules.pdf

Regards

Chilla..

stefan_grube
Active Contributor
0 Kudos

No, this is not possible.

You have to write an adapter module to achieve this.

Regards

Stefan

stefan_grube
Active Contributor
0 Kudos

I have seen that XSLT mapping creates <field /> as well. Maybe you can go for XSLT in your scenario.

Regards

Stefan