How to send message body to CDATA using stanza?
I am generating messages like this
$msg({to: 'user', from: 'me', type: 'chat'}).c("body").t('some data');
which generates:
<message to='user' from='me' type='chat' xmlns='jabber:client'>
<body>some data</body>
</message>
but I need this:
<message to='user' from='me' type='chat' xmlns='jabber:client'>
<body><![CDATA[some data]]></body>
</message>
do strophejs
there is something or do I need to generate them myself? Is it possible to send CDATA to XMPP?
+3
source to share
1 answer
You can send CDATA, but I don't think you need to care about that in this case. Just pass string data to the method .t()
and it should take care of it.
There is also no guarantee that CDATA will still be CDATA, at least one server will re-serialize it as a plain text node with objects &escaped;
.
+2
source to share