Information in Custom XML added to message packet is getting stripped off

I want to add custom xml to an incoming message packet. To do that as part of plugin implementation I have written a PacketInterceptor, which intercepts the message and adds an extension. Till this point everything is fine but when this message is received by the receiver, the information stored in custom xml is striped off. Only the xml element with namespaces is shown.

Incoming messages are regular text messages as shown below-

Hi

When I add custom xml to this message body, it looks as below after adding the xml in PacketInterceptor logs-

Hi

But when this message is received by the receiver the value attribute in data is striped off and below message is received by the participant -

Hi

Please note that both the text and attributes are getting stripped off from data xml node.

Below is java code snippet for your reference-

============================

public void interceptPacket(Packet packet, Session session, boolean incoming,

boolean processed) throws PacketRejectedException {

// Some code

Message messagePacket = (Message) packet;

Document document = DocumentHelper.createDocument();

Element root = document.addElement(“data”);

Element root1 = root.addAttribute(“value”, “imgURL1”);

PacketExtension pe = new PacketExtension(root1);

messagePacket.addExtension(pe);

}

============================

Any quick help will be highly appreciated.