The Conversation as XML Documents
The conversation is two-way, duplexed across a socket connection. On one side, the client sends an XML document to the server. On the other side, the server responds by sending an XML document to the client. Figure 5-3 shows the pair of XML documents being streamed across the TCP socket connection between client and server, over time.
![]() |
But what do we mean when we say that the conversation is an XML document? To answer this, consider this simple XML document:
<?xml version="1.0"?> <roottag> <fragment1/> <fragment2/> <fragment3/> ... <fragmentN/> </roottag>
The document starts with an XML declaration:
<?xml version="1.0"?>
which is immediately followed by the opening root tag. This root tag is significant because there can be only one (and, of course, its corresponding closing tag) in the whole document. In effect, it wraps and contextualizes the content of the document:
<roottag> ... </roottag>
The real content of the document is made up of the XML fragments that come after the opening root tag:
<fragment1/> <fragment2/> <fragment3/> ... <fragmentN/>
So, taking a connection between a Jabber client and a Jabber server as an example, this is exactly what we have. The server is listening on port 5222 for incoming client-initiated connections. Once a client ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
