> Java has pull parsers available that get around the problem and I find > are much better suited for streaming XML found in XMPP. Pull parsers > are the mirror opposite of push parsers like SAX; in pull parsing > events are pulled from the parser by calling methods on the parser when > you're ready for the next token - as opposed to SAX where the events > are pushed to you in callbacks. For XMPP, you can simplify your logic > by handing the parser over to specialized event consumers based on the > first tag (e.g. see iq tag, give parser to iq handler to read and > handle, etc). The pull parser I've used quite a lot is: > http://www.xmlpull.org which has the benefit of being open source, > small, and wicked fast. BEA is chairing a JCP committee to establish a > Java pull parsing standard (named stax). You can find it at BEA's site, > or the JCP site (search for stax). > > Finally, since you're working with Java, I have to push Smack. Java, > open source, simple, extensible, small, and uses xml pull parsing under > the covers. You may want to check it out. Makes working with XMPP in > Java a breeze: http://www.jivesoftware.com/xmpp/smack
Pull parsers are great but I have to feed my input on Smack in here. It's very nice... for the person using the API. The person who has to write new extension packets is in for a world of hurt because you have to use the pull parser directly. The result of making a single mistake, forgetting to parse a tag or what not, is that the entire stream breaks. It would be much more same to use XPP in a single loop to build up a miniature DOM, and then to wrap the DOM with data classes. You then have no risk of the extension developer busting up the stream since all the stream is handled in the same place. My other gripe with Smack is fairly minor, and it's that they don't reflect the Jabber data model. I'm sure it was done for convenience though because the only place where this really sticks out is that they bundle together the Query and the IQ into a single class (I would much rather it be in one class.) But in every other way they rule. And if you don't need to write any extension packets ever, it really is the easiest API. TX -- 'Every sufficiently advanced technology is indistinguishable from magic' - Arthur C Clarke 'Every sufficiently advanced magic is indistinguishable from technology' - Tom Graves Email: Trejkaz Xaoza <[EMAIL PROTECTED]> Web site: http://xaoza.net/trejkaz/ Jabber ID: [EMAIL PROTECTED] GPG Fingerprint: 26CF 8621 223F 3916 8872 65C5 9A27 F3C0 130F C71A
pgp00000.pgp
Description: PGP signature
_______________________________________________ jdev mailing list [EMAIL PROTECTED] https://jabberstudio.org/mailman/listinfo/jdev