[JDEV] Why XML?
Jon A. Cruz
joncruz at geocities.com
Tue Jan 12 21:29:43 CST 1999
Sedat Kapanoglu wrote:
> I am new to this Jabber concept but there things confusing my mind and I'd
> like to share them.
> First, XML occupies much more space than a binary coded protocol. (And as
> flexible as XML with a design similar to IFF files). XML will surely eat
Not surely. If you have network packets being padded, a few extra bytes are not
likely to matter.
Now, if you are doing something like real-time audio, then it might. But for
such a low-bandwidth transmition, you'd barely notice the slowdown.
It's probably important to measure things before guessing, otherwise you might
end up doing the equivalent of optimizing the system idle loop.
> Also, XML will slow down the protocol parsing code and will make
> client/server coding harder. A binary type protocol would allow us to
> directly use struct's etc etc.
Yes. No. Yes, the parsing might be a little slower, but no, that will not need
to make coding harder. You just grab a standard parsing library and hook it up.
Look into the SAX interface for Java for an example.
Binary??? Ouch. Directly use structs?? Ouch.
Which platform, compiler, packing options??
Intel byte-order or Motorolla?
8,16, 32 or 64 bit alignment???
What if you change your C/C++ code? Break the protocol???
( ever seen the .TGA file format? )
> Protocols are used between software to negotiate, not the users themselves.
> So visual appeal of the protocol doesn't mean much to me :)
Yes, but XML makes the functional aspect of the protocol so much stronger.
Noticing a missing '>' is far easier than noticing a missing bit. Besides, this
gives you a wealth of tools for viewing the data exchanged, debugging, etc.
> I might have skipped a trick on XML but if I am wrong please correct me.
More information about the JDev