if I've well understood, this is the best way to do it. (even if I can't find the spec about the <x> tag ;-) I have to search more... )Yes, any other tag may be transported inside the message tag, as long as they have a fully qualified namespace [ http://www.ietf.org/rfc/rfc3921.txt ]:
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element ref='subject'/>
<xs:element ref='body'/>
<xs:element ref='thread'/>
</xs:choice>
<xs:any namespace='##other'
minOccurs='0'
maxOccurs='unbounded'/>
<xs:element ref='error'
minOccurs='0'/>But do yourself a favor and put things inside an x-tag.
Not the specs but ok [ http://www.oreilly.de/catalog/jabber/chapter/ ]:
*/x/*
------------------------------------------------------------------------
<message to='[EMAIL PROTECTED]' type='chat' from='[EMAIL PROTECTED]/laptop'>
<body>Hi - let me know when you get back. Thanks.</body>
*<x xmlns='jabber:x:delay' from='[EMAIL PROTECTED]' stamp='20010514T14:44:09'>
Offline Storage
</x>*
</message>
*name: *Optional
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 data contained within the <x/> tag is formatted depending on the namespace.
In the example, the payload is carried in addition to the <body/> subelement. However, as the <body/> is actually /optional/ in a message, it is possible to transmit structured payloads between Jabber entities without the need for "conventional" message content.
_______________________________________________ jdev mailing list [email protected] http://mail.jabber.org/mailman/listinfo/jdev
