Hi Naveen,
See this mapping where all items are mapped one to one except item3 which is linked to target field mapwithdefault
Image may be NSFW.
Clik here to view.
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