AnsweredAssumed Answered

Stripped off xmlns attributes after packet parsing

Question asked by tibo on Apr 26, 2016
Latest reply on Apr 26, 2016 by tibo

Hello everybody,


I have a question regarding the Smack library (now using 4.1.4). I am using it to exchange marshalled xml information. To do so I am using JAXB for the marshalling/unmarshalling and JAXB notations. The issue I have is for nullable fields. To mark null fields, JAXB uses a tag such as : <field xsi:nil="true" xmlns:xsi="\"/>. For the marshalling and sending I have no issue, the message is properly received, which I could confirm using the debugger. The issue seems to occur after the packet has been processed. There for the same tag I get: <field nil="true"/>. The problem is that JAXB does not recognize this tag as a null element and thus goes on to create an instance of the field, which is undesired.


My question is thus if this stripping of xmlns attribute is normal? Or could it be something I am doing wrong? I have looked quite thoroughly in my own code and could not see where this stripping could have occurred, and thus assumed that it might come from Smack. For now I managed a workaround by re-inserting the xsi and xmlns attributes before the unmarshalling, but I was wondering if this was a bug or an expected behavior.


Thank you in advance for any help!