Posted: Mon Apr 27, 2015 4:13 am Post subject: Removing NULL elements with the attribute xsi:nil="true
Centurion
Joined: 13 May 2014 Posts: 121
Hi,
I have a problem with the incoming fields where the element is NULL and has a nil attribute set to true. For e.g. -
Code:
<FieldA xsi:nil="true" />
The problem is that it is a big incoming xml with almost 100 fields and wherever there is no value, I am getting an empty tag like the above.
In my code, I am transforming the incoming message to my canonical message model. But I dont want to set any fields in my canonical where there is no value in the incoming message but only the nil attribute.
that the parser will give a no value but a child attribute.
Is there any way I could eliminate such fields in my esql without checking every single field?
Any utility or a Java function which could check such null fields and remove them from the output?
Even a hint to write such would help.
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
You might want to look at following link , which talks about how you deal with null and empty elements.
You might want to check (at info centre) about XML.tag or XML.attr for such elements with child attributes.
Also, in case you are using graphical mapper then you can easily detect (in for each tranformation loop) the elements with nil='true' and use 'create' transform to deal with such elements in the message. (there are few other topics related to the same concern/issue, if you wanted to search.)
_________________ *Life will beat you down, you need to decide to fight back or leave it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum