The Opening Tag

Earlier, we said that the opening document tag was used by the client to “announce its intentions.” The following is a typical opening document tag from a Jabber client that has made a socket connection to port 5222 on the Jabber server jabber.org:

<stream:stream
    xmlns:stream="http://etherx.jabber.org/streams"
    to="jabber.org"
    xmlns="jabber:client">

There are four parts to this opening tag:

The <stream:stream> tag

Every streaming Jabber XML document must start, and end, with a <stream:stream> tag, qualified with the stream namespace.

The stream namespace declaration

xmlns:stream="http://etherx.jabber.org/streams"

The declaration of the stream namespace also comes in the opening stream tag. It refers to a URL (http://etherx.jabber.org/streams), which is a fixed value and serves to uniquely identify the stream namespace used in the XML document, rooted with <stream/>, that is, streamed over a Jabber connection.

The namespace qualifies only the tags that are prefixed stream:. Apart from stream, there is one other tag name used in these documents that is qualified by this namespace, and that is error. The <stream:error/> tag is used to convey Jabber XML stream connection errors, such as premature disconnection, invalid namespace specifications, incomplete root tag definitions, a timeout while waiting for authentication to follow the root tag exchange, and so on.

The to attribute

to="jabber.org"

There is a to attribute that specifies to which Jabber server 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.