[jdev] Re: Splitting the stream

Michal 'vorner' Vaner michal.vaner at kdemail.net
Wed Nov 1 11:12:36 CST 2006


Hello,

On Wed, Nov 01, 2006 at 06:12:15PM +0100, Alexander Gnauck wrote:
> Matthias Wimmer wrote:
> >Michal 'vorner' Vaner schrieb:
> >>And, if I have these split things and insert them between the stream
> >>header I got in the beginning and an corresponding stream end, can I
> >>parse it using DOM parser for each separate stanza?
> >
> >But that is something I would not do. It requires you to parse the
> >complete data twice. I'd just use a SAX parser for the complete stream.
> >And with the SAX-events you can generate DOM-Nodes in a DOM-Document.
> >
> >E.g. you could have one document for the stream, generated inside the
> >SAX-Events. When you notice, that a stanza has been completed, you can
> >call the handler for the stanza with the handle/pointer/... to that
> >element in the document. After the handler returned/the stanza has been
> >processed, you can just remove that stanza root element from the DOM
> >document again.
>
> i agree with Matthias.
> The technique you should use also depends on the programming language 
> and the XML libraries you use. From my experience "SAX like" techniques 
> works very well for XMPP streams.
> ==> Parsing the stream with Sax and build your Dom or stanzas from the 
> sax callbacks.


Well, I just think I do not need to _parse_ it if I'm not interested in
the information there. I only want to split it to parts and feed that to
different program.

> As Matthias already mentioned some developers see the complete stream 
> (including the header) as one XML Document, others use the header only 
> to grab the correct namespace and see each stanza as a new DOM which is 
> not in the context of the stream header.
> 
> All techniques have their pros and cons which also strongly depends on 
> your programming language and XML libraries.
> 
> It also depends on your project and requirements. It's a big difference 
> if you need a light and really fast implementation for a embedded 
> device, or if you don't care about speed but want a complete namespace 
> correct and validating implementation.
> 
I need to make it many small independent programs. Which I think nobody
yet did. It is just an experiment, maybe it wont work at all, it is
possible something very flexible may become of it, I just do not know.

Thank you for your comments.

-- 
Please stay calm. There is no use both of us being hysterical.

Michal "vorner" Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20061101/a5ca898a/attachment-0002.pgp>


More information about the JDev mailing list