Search code examples
xmppsmackcdata

How do I get the CDATA from a [Smack XMPP API] MultiUserChat Message?


Smack's debugging console messages show me a full message including the message detail in the CDATA I'm looking for:

11:45:05 AM RECV (0): <
11:45:05 AM RECV (0): message to="[email protected]/Smack" type="groupchat" from="[email protected]/roomname-abc"><body>ABCD issues  valid 2015-06-05T15:45:00Z</body><html xmlns="http://jabber.org/protocol/xhtml-im"><body xmlns="http://www.w3.org/1999/xhtml">ABCD issues  valid 2015-06-05T15:45:00Z</body></html>
  <x xmlns="roomname-abc" issue="2015-06-05T15:45:00Z" someid="foo" id="1234.5678"><![CDATA[

+------------------------+
| THIS IS MESSAGE DETAIL |
| INSIDE    THE    CDATA |
| THAT  I   REALLY  NEED |
+------------------------+

]]></x></message>

But in my code, when I look at a Message, all the detail has been stripped out from inside the <x></x> element, including some of its attributes:

<message to='[email protected]/Smack' from='[email protected]/roomname-abc' type='groupchat'><body>ABCD issues  valid 2015-06-05T15:45:00Z</body><html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns="http://www.w3.org/1999/xhtml">ABCD issues  valid 2015-06-05T15:45:00Z</body></html>
  <x xmlns='roomname-abc'></x></message>

What happened to that detail, how did the console see it but I can't, how can I get the CDATA?


Solution

  • Under time pressure to get this done, I reimplemented my client using Babbler instead of Smack and got what I needed done. (The CDATA I needed was preserved in the message extensions and I didn't have to write additional code.)