[jdev] Escaping JID using XEP-0106

Matthias Wimmer m at tthias.eu
Wed Jun 27 06:33:29 CDT 2007

Hi Sergei!

Ah okay ... it seems I start understanding what you are trying to do.
You want to map a JID (or something like that) into another JID, e.g.
for building the infamous Jabber-Jabber transport.

Sergei Golovan schrieb:
> So, a full unsecaped JID (with resource) can't be split unambiguously.
> Then I'm afraid we should do something with the XEP.

You will always only handle escaped JIDs when splitting the JID.

If you do unescape the JID, you should do this to get back the mapped

E.g. if you unescape "foo\40bar at jabber.org" you do not get back
"foo at bar" and not "foo at bar@jabber.org".

Compare this with the escaping in XML:

If you map "<element>this is XML</element>" in an XHTML document you get:

<p>&lt;element&gt;this is XML&lt;/element&gt;</p>

You will also only be able to unescape the content of the <p/> element
without creating a mess. If you would just unescape everything you would
get <p><element>this is XML</element></p> and with that also no XML
parser could understand what of this is your XHTML and what is your XML
document you wrapped.


Matthias Wimmer      Fon +49-700 77 00 77 70
Züricher Str. 243    Fax +49-89 95 89 91 56
81476 München        http://ma.tthias.eu/

More information about the JDev mailing list