[JDEV] just wondering...

Michael F Lin MFLIN at us.ibm.com
Mon Jan 7 14:23:18 CST 2002


The session is set up as a continuous Jabber document for correct and
efficient namespace handling. You will notice in the stream:stream tag that
a default namespace jabber:client is specified. Since all the message, iq,
and presence elements are children of this document, they adopt this
default namespace automatically. If you wanted to transport individual
documents (as opposed to one continuous document), then each element would
have to have the xmlns="jabber:client" attribute for correct namespace
handling, which would be wasteful.

This is a bit pedantic in the sense that using correct namespace handling
for the main 3 packets really doesn't provide any technical advantages in
the case of Jabber. But, it is The Right Way (TM) to do things.

-Mike



|---------+---------------------------->
|         |           zak              |
|         |           <zsy at photoalley.c|
|         |           om>              |
|         |           Sent by:         |
|         |           jdev-admin at jabber|
|         |           .org             |
|         |                            |
|         |                            |
|         |           01/04/2002 07:41 |
|         |           PM               |
|         |           Please respond to|
|         |           jdev             |
|         |                            |
|---------+---------------------------->
  >------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                              |
  |       To:       jdev at jabber.org                                                                                              |
  |       cc:                                                                                                                    |
  |       Subject:  [JDEV] just wondering...                                                                                     |
  |                                                                                                                              |
  |                                                                                                                              |
  >------------------------------------------------------------------------------------------------------------------------------|



hi all,

i was just wondering why the opening xml stream was designed to work the
way
it does.  my question really is why can't/should't/doesn't the opening xml
stream contain a closing element?  what is the rationale behind keeping a
running xml document going for the duration of the session.  furthurmore,
it
makes it akward to use some of the handy XML libraries out there like JDOM,

dom4j, etc. because many of the classes require well formed xml.  i know
that
the sax parser makes it possible to deal with non well formed xml, but i'd
prefer to just drop the data returned by the server in to some sort of
document class instead of using a sax handler to pick out the individual
xml
elements i'm interested in.  plus using the sax parser to directly read
from
a socket inputstream has it's own associated issues i'd like to avoid.

for example, instead of sending this...

 <?xml version='1.0' encoding='UTF-8' ?> <stream:stream to='jabber.org'
xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>

doesn't it make sense to send...

 <?xml version='1.0' encoding='UTF-8' ?> <stream:stream to='jabber.com'
xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>
</stream:stream>

i'm interested to hear how other people are dealing with this, and how any
of
you are using libraries such as JDOM.  i'm not slamming the implementation.

just curious.

regards, zak.
_______________________________________________
jdev mailing list
jdev at jabber.org
http://mailman.jabber.org/listinfo/jdev







More information about the JDev mailing list