> >From what I've glimpsed in the Smack 1.4 documentation, there are > subclasses of IQ that actually represent stanzas with certain > IM extensions. Parsing extensions to determine that > convenience subtype can be costly for the applications that > aren't interested.
In Smack, it's really not very costly. Also, you don't have to parse IQ's into objects if you don't want to -- it's all up to the providers that are installed. > Also, stanzas containing multiple > extensions end up classified on the basis of some perceived > "main" extension, which is not guaranteed to be the first in > order, so the logic becomes rather hairy. Oh well, I'm > nitpicking, this is an IM library after all. Actually, not quite. IQ's are parsed into objects but packet extensions are just parsed into packet extension objects. You can then get individual packet extensions off of the Message or Presence object. This solves the composition problem nicely (where you can have multiple packet extensions in one message, for example). > > > - Three forms of representation: stanza/extension objects > - DOM-like > > > trees - raw character strings. > > > > Smack provides objects and raw strings at the moment but not a full > > DOM model. We've actually been working on that last part in > our Whack > > library (upcoming library targeted at components). It's a > packet API > > that wraps DOM4J Element objects. > > OK, but does it mean that JAXP DOM is in disgrace? > Take a look at the JSO library; they use a simplified model > (indeed, XMPP doesn't need many things that DOM provides) > that permits JAXP, DOM4J, and more slender "micro" implementations. I'm actually not a big fan of the JSO approach. It seems to work, but re-implementing a DOM API is very unecessary. If you compare the Whack packet API to JSO, there is a fundamental difference between how clean the API's are. This is mostly due to the fact that JSO exposes all the DOM manipulation through object inheritance. For example, why would most developers want a Presence.normalizeTrimText method (inherited from StreamElement)? Whack hides DOM until you need it through Packet.getElement(). Anyway, if you're interested in discussing further, I'd suggest the Whack dev forum at: http://www.jivesoftware.org/forums/forum.jspa?forumID=44 Regards, Matt _______________________________________________ jdev mailing list [email protected] http://mail.jabber.org/mailman/listinfo/jdev
