In depth discussion on how namespaces are handled.
Version: 1.02Net::XMPP::Namespaces - In depth discussion on how namespaces are handled.
Operating System: Linux
Net::XMPP::Namespaces provides an depth look at how Net::XMPP handles namespacs, and how to add your own custom ones. It also serves as the storage bin for all of the Namespace information Net::XMPP requires.
XMPP as a protocol is very well defined. There are three main top level packets (message, iq, and presence). There is also a way to extend the protocol in a very clear and strucutred way, via namespaces.
Two major ways that namespaces are used in Jabber is for making the < iq/ > a generic wrapper, and as a way for adding data to any packet via a child tag < x/ >. We will use < x/ > to represent the packet, but in reality it could be any child tag: < foo/ >, < data/ >, < error/ >, etc.
The Info/Query packet uses namespaces to determine the type of information to access. Usually there is a tag in the that represents the namespace, but in fact it can be any tag. The definition of the Query portion, is the first tag that has a namespace.
< iq type="get" >< query xmlns="..."/ >< /iq >
< iq type="get" >< foo xmlns="..."/ >< /iq >
After that Query stanza can be any number of other stanzas ( tags) you want to include. The Query packet is represented and available by calling GetQuery() or GetChild(), and the other namespaces are available by calling GetChild().
The X tag is just a way to piggy back data on other packets. Like embedding the timestamp for a message using jabber:x:delay, or signing you presence for encryption using jabber:x:signed.
To this end, Net::XMPP has sought to find a way to easily, and clearly define the functions needed to access the XML for a namespace. We will go over the full docs, and then show two examples of real namespaces so that you can see what we are talking about.