Name

x — Optional

Synopsis

<message to='dj@yak' type='chat' from='sabine@yak/laptop'>
  <body>Hi - let me know when you get back. Thanks.</body>
  <x xmlns='jabber:x:delay' from='dj@yak' stamp='20010514T14:44:09'>
    Offline Storage
  </x>
</message>

The <x/> subelement is special. While the other subelements like <body/> and <thread/> are fixed into the Jabber building blocks design, the <x/> subelement allows <message/> elements to be extended to suit requirements. What the <x/> subelement does is provide an anchor point for further information to be attached to messages in a structured way.

The information attached to a message is often called the payload. Multiple anchor points can be used to convey multiple payloads, and each one must be qualified using a namespace.

Just as the content of XML streams is qualified by a namespace (one from the list in Table 5-2 earlier in this chapter), so the content of the <x/> attachment must be qualified. There are a number of Jabber-standard namespaces that are defined for various purposes. One of these, jabber:x:delay, is used in the example. These standard namespaces are described in Chapter 6. But there’s nothing to stop you defining your own namespace to describe (and qualify) the data that you wish to transport in a <message/>. Namespaces beginning jabber: are reserved; anything else is OK.

Briefly, you can see how payloads are attached from the example. For every <x/> subelement, there’s an xmlns attribute that qualifies it, and the ...

Get Programming Jabber now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.