[jdev] My outgoing jabber packet
hildjj at gmail.com
Fri Mar 11 17:27:45 CST 2005
> NET?? I'm in the middle of porting my jabber applet to C# so I can offer
> some advice here as well. .NET currently has a bug when it comes to using
> the xml reader to parse an input stream, it raised hell in the jabber
> community and was quite the fuss for a while until they disovered a work
> around which I presonally would not implement given that I am starting from
> scratch. Instead of reading the xml straight from the jabber stream, I use
> the stream BeginRead and EndRead asynchronous calls. When data arrives, I
> grab the first xml fragment (by fragment I mean <tag><subtags/></tag>) via a
> regex expression. I then create an XMLDocument and call the LoadXML method
> to load the xml fragment in. Then I build my own custom elements array by
> parsing the xml document via a recursive function. Now that all the all the
> elements are in my array, I can search through them as I please.
This won't work, if any of your stanzas get fragmented, either by a
network element, or because they are longer that one MTU. Either of
these can happen at any time, but won't show up in testing with small
packets on a local machine.
Jabber-Net now has a comprehensive workaround for this problem, in the
form of a port of portions of James Clark's XP parser from Java to C#.
XP can deal with partial stanzas quite nicely, and as a side effect,
is very fast.
More information about the JDev