[JDEV] CDATA in messages

Joe Hildebrand JHildebrand at jabber.com
Wed Aug 28 12:05:37 CDT 2002

Unless I'm misunderstanding something, this isn't a problem in Exodus; I
think pgm got that right from the start.  I just tried sending this from a
chat window in Exodus, and this was sent, as expected:

<message id="jcl_9" to="..." type="chat">
  <body>&lt;![[CDATA[ hello ]]&gt;</body>

I think you may have been typing into the debug window, since you're looking
at the spool file and such.  Probably something like:

<message id="jcl_9" to="..." type="chat">
  <body><![[CDATA[ hello ]]></body>

If so, the client connection manager (jadc2s?  ccm?  jpolld?) usually ends
up doing some cannonicalization the XML coming through.  In particular,
CDATA segments will usually be turned into their &escaped equivalents,
quotes will be regularized, and comments and processing instructions will be
stripped out.  This is because after the XML is parsed, it's stored in a
DOM, and then reserialized.  In most of the DOM implementations that Jabber
servers use, there is no way to distinguish between a CDATA block and a
non-CDATA-escaped text block.

More to the point, why would you care?  As long as 

<body><![[CDATA[ < ]]></body>

comes out the other side as:

<body> &lt; </body>

how are you going to process it differently?

Joe Hildebrand

> -----Original Message-----
> From: David Waite [mailto:mass at akuma.org]
> Sent: Wednesday, August 28, 2002 9:58 AM
> To: jdev at jabber.org
> Subject: Re: [JDEV] CDATA in messages
> It appears Exodus is not escaping the CDATA block. It is also not 
> excaping entities e.g. &amp;. I would file a bug against that project.
> -David Waite
> Jens Askengren wrote:
> >I just had a discussion about xml over jabber..
> >
> >I typed something like this:
> >
> >	<![[CDATA[ hello ]]>
> >
> >but my peer recieved 
> >
> >	  hello 
> >
> >So the CDATA tag was interpreted somewhere in the
> >message chain: Exodus <-> jabberd <-> Gabber.
> >
> >Repeating the test while the recipient was offline, resulted in
> >a message with <body> hello </body> beeing stored in the 
> jabberd spool
> >file.
> >
> >Either jabberd or the clients are broken I guess. 
> >But the clients does encode regular tags correctly. I dont understand
> >why a CDATA tag should be trated differently.
> >
> >
> >  
> >
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev

More information about the JDev mailing list